Sunday 10 August 2014

Write a shell script using expr command to read in a string and display a suitable message if it does not have at least 10 characters.


echo "Enter a String"
read str
c=`expr "$str" : '.*'`
if [ $c -lt 10 ]
then
echo "The String has Less than 10 charecter"
else
echo "The String has $c charecters"
fi

1 comments:

Unknown said...

It is a super n shortest shell script thank u study it today for being there

Post a Comment

 
- |