Reputation: 1267
I have a bunch of files in bash named myfile1.sh
, myfile2.sh
, myfile3.sh
... and so on. I would like to remove the sh
part in each one of them, that is: rename to myfile1
, myfile2
, myfile3
, ... Do you have a suggestion to do it all at once?
Thanks in advance.
Upvotes: 0
Views: 68
Reputation: 121357
If you have the rename
command, you can use it:
rename 's/\.sh$//' *.sh
A bash one-liner can be:
for f in *.sh; do mv "$f" "${f%.sh}"; done
Upvotes: 0