Thursday 29 March 2018

Shell script to display filenames in uppercase

#shell script to display filename to uppercase
if  [ $# -eq 0 ]
then
       echo “Pass an argument”
else
    for file in $*
    do
           if test -f $file
           then
                 echo  $file|tr ‘[a-z]’ ‘[A-Z]’
           else
                 echo “File $file does not exist”
           fi
    done
fi










OUTPUT
csc@csc-SVE1513CYNB ~ $ sh upper.sh well simple.c shan
WELL
SIMPLE.C
File shan does not exist

No comments:

Post a Comment