Shell Script to check if a string is palindrome or not
Program
#!/bin/bash
echo "Enter a String"
read input
reverse=""
len=${#input}
for (( i=$len-1; i>=0; i-- ))
do
reverse="$reverse${input:$i:1}"
done
if [ $input == $reverse ]
then
echo "$input is palindrome"
else
echo "$input is not palindrome"
fi
Output 1
Enter a String
test
test is not palindrome
Output 2
Enter a String
malayalam
malayalam is palindrome