I wrote a small script that should rename some files in a directory for me.
#!/bin/bash
a=1
for i in *.jpg ; do
new=$(printf "%04d.jpg" "$a")
mv "$i" "$new"
let a=a+1
done
#end of file
After running the script is says this: "mv: command not found"
How come there are no error outputs when I run the code directly on the shell like this:
for i in *.jpg ; do new=$(printf "%04d.jpg" "$a") ; mv $i $new ; let a=a+1 ; done