Description
unix shell scripting programs

Explanation & Answer

Example Shell Script: Convert Filenames to Lowercase 6/8
A script to convert the specified filenames to lower case.
if test $# = 0
then
echo "Usage $0: <files>" 1>&2
exit 1
fi
for filename in "$@"
do
new_filename=`echo "$filename" | tr A-Z a-z`
test "$filename" = "$new_filename" && continue
if test -r "$new_filename"
then
echo "$0: $new_filename exists" 1>&2
elif test -e "$filename"
then
mv "$filename" "$new_filename"
else
echo "$0: $filename not found" 1>&2
fi
done
http://www.cse.unsw.edu.au/~cs2041/12s2/lec/shell/examples.notes.html
