So this is short script used to rename extension of files i found on tldp.
#!/bin/bash
Mysterious=65
case $# in
0|1)
echo "Usage: `basename $0` old_file_extension new_file_extension"
exit $Mysterious
;;
esac
for filename in *.$1
do
mv $filename ${filename%$1}$2
done
exit 0
I don't understand about the value of Mysterious variable. Why did the script's owner choose 65 and why we had to use case $# in 0 or 1? I changed value 65 into 100 and it still worked.
0|1)
just means the script has to be passed more than 1 argument... – jasonwryan May 16 '16 at 03:22exit 0
is superfluous, that's the default when a script ends normally. – cas May 16 '16 at 03:53