• Source
    1. #
    2. #Accept the string and checks whether the string is palindrome or not.
    3. #
    4. echo -n "Enter any string --->"
    5. read string
    6.  
    7. length=$((`echo $string | wc -c` - 1))
    8.  
    9. i=$length
    10.  
    11. revstr=""
    12. while [ $i -gt 0 ]
    13. do
    14.  
    15. revstr=$revstr`echo $string | cut -c $i`
    16. i=`expr $i - 1`
    17. done
    18. if [ "$revstr" = "$string" ]
    19. then
    20. echo "String is palindrome"
    21. else
    22.  
    23. echo "String is not palindrome"
    24. fi
    25.