example programs in shell scripting

User Generated

ivabyvxr

Programming

Description

unix shell scripting programs

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

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


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags