Write a shell script to validate the name of a person accepted through the keyboard so that it does not exceed 8 chars of length.

echo "Enter your name"
read name

len=`echo -n $name | wc -c`
if [ $len -ge 8 ]
then
	echo "Sorry your name is not accept becuase it is greater than 8"
else
	echo "Ok accepted"
fi

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *