Is there anything I’m doing wrong here in this piece of code?
OLD_NAME="$FILE"
NEW_FILE=`${OLD_NAME | tr ' ' '_'}`
/bin/mv "$OLD_NAME" "$NEW_FILE"
All I want is to rename the supplied file and replace all the spaces with underscores.
I’m getting bad substitution error message. I can’t seem to get the renaming to work 🙁
Any help would be appreciated.
You need to echo the OLD_NAME into tr:
But perhaps you would prefer: