Write a shell script to check entered string is palindrome or not
echo -n "enter string: "
read str
flag=0
cnt=`expr $str : '.*'`
i=1
l=`expr $cnt / 2`
while [ $l -gt $i ]
do
c1=`echo $str|cut -c$i`
c2=`echo $str|cut -c$cnt`
if [ $c1 != $c2 ]
then
flag=1
break
fi
i=`expr $i + 1`
cnt=`expr $cnt - 1`
done
if [ $flag -eq 1 ]
then
echo "Not palindrome"
else
echo "Palindrome"
fi