|
# Shell Program for strings for Checking of
Palindrome
echo “Enter a String to check for Palindrome
“
read str
i=1
y=`expr $str | wc –c`
y=`expr $y – 1’
z=$y
echo “The Length of String $str = $y”
while [ $y –ne 0 ]
do
z=`expr $str | cut –c $i`
w=`expr $str | cut –c $y`
if [“$z” != “$w”]
then
echo “ The Given String $str is not
Palindrome”
y=0
else
i=`expr $i + 1’
y=`expr $y - 1`
fi
done
if [ “$z” ==”$w”]
then
echo “The Given String $str is a Palindrome”
fi |