lundi 15 janvier 2018

Why echo function is not printing anything here?

In this shellscript, I have created 3 functions. It will take 2 command line arguments. first for the type of the operation and second for a string to perform something on it.. Here, my echo command in any of the functions is not printing anything..

Any Help would be appreciated.

clear

lower()
{
echo $2 | tr "[A-Z]" "[a-z]"
}

upper()
{
echo $2 | tr "[a-z]" "[A-Z]"
}

proper()
{
echo $2 | sed 's/.*/\L&/; s/[a-z]*/\u&/g'
}


#echo "Enter The Option and then the string to perform the operation:"
echo $1 $2 '> echo $1 $2 '

if [ $1 = "-l" ]
then
lower $2
elif [ $1 = "-u" ]
then
upper $2
elif [ $1 = "-p" ] 
then 
proper $2
fi

Aucun commentaire:

Enregistrer un commentaire