I need to write a script that will automatically rename a number of files and include a user defined string. As an example, I want the file *001.jpg renamed to "user defined string" + 001.jpg (ex: MyVacation20110725_001.jpg).
This is what I’ve tried so far:
#!/bin/sh
echo "Type the user-defined string, followed by [Enter]: "
read str
for file in *.jpg; do
`sed s/$str_$file/$file/`;
done
The problem is that nothing is happening.
You can try this on your loop: