write a shell script to identify the given string is
palindrome or not?

Answer Posted / hemanth kadham

echo "PALINDROME NUMBER"
echo "ENTER THE NUMBER :"
read n
n1=$n
rev=0
while [ $n1 -ne 0 ]
do
rem=`expr $n1 % 10`
n1=`expr $n1 / 10`
rev=`expr $rem + $n1 \* 10`
done
if [ $n -eq $rev ]
then
echo $n is a Palindrome Number
else
echo $n is not a Palindrome Number
fi

PALINDROME NUMBER
ENTER THE NUMBER :
121
121 is a Palindrome Number
$sh palno.sh
PALINDROME NUMBER
ENTER THE NUMBER :
123
123 is not a Palindrome Number

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the significance of $#?

586


What are the advantages of shell script?

517


How to print pid of the current shell?

602


Is cmd a shell?

591


Which shell is the best?

572






What is shift command in shell script?

522


Explain about the slow execution speed of shells?

773


Explain about sourcing commands?

634


Explain about login shell?

633


What is the first line in a shell script?

553


What are the different variables present in linux shell?

610


Explain about stdin, stdout and stderr?

629


What is path in shell script?

636


What is a shell environment?

572


shell script for reverse the string

914