I've got some files like this:
database1-backup-01-01-2011.sql
database2-backup-01-01-2011.sql
…etc. I want to rename them to add AM, like this:
database1-backup-01-01-2011-AM.sql
database2-backup-01-01-2011-AM.sql
What's the most concise way to do that from the bash shell?
Best Answer
Another option:
This loops through all the .sql files and renames them to end in -AM.sql instead.
PROTIP: Use
$(command)
instead of`command`
in your scripts (and command-lines), it makes quoting and escaping less of a nightmare.