read n n1=$n l=`expr length $n` r="" i=$l while [ $i -ne 0 do x=`expr $n | cut -c $i` r=$r$x i=`expr $i - 1` done if [ $n == $r ] then echo "the given string is palindrome" else echo "the given string is not a palindrome" fi
output :
bash-4.2$ vi revstring.sh bash-4.2$ sh revstring.sh