postheadericon Write a script to check whether a given string is palindrome or not


File Name : ex20.sh


clear
echo "Enter String : \c"
read s
p=$s

m=`expr $s | wc -c`
i=`expr $m - 1`

while [ $i -ge 1 ]
do
            k=`expr $s | cut -c$i`
            r=$r$k
            i=`expr $i - 1`
            echo $k
done
            echo $r
if [ "$p" != "$r" ]
then
            echo "It is not palindrome"
else
            echo "It is palindrome"
fi


0 comments:

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.