example programs in shell scripting

User Generated

ivabyvxr

Programming

Question Description

unix shell scripting programs

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with 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

GurQnexXavtug (3)
New York University

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

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4