Reputation: 1789
Suppose I have some files in a dir called test_dir
, like a.sh
, b.sh
, c.sh
, d.bash
, and so on. I need to change all the file *.sh
to *.bash
. How can I achieve it using shell?
Upvotes: 0
Views: 72
Reputation: 25144
Can be done in a single one-liner:
ls *.sh | while read i; do mv "$i" "${i%.sh}.bash"; done
Upvotes: 2