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

Answer Posted / lekhrajdeshmukh

n=$1
a=0
b=0
while [ $n -gt 0 ]
do
b=$(( $n % 10 ))
a=$(( ($a * 10) + $b ))
n=$(( $n /10 ))
done
if [ $a -eq $1 ]
then
echo "$1 number is palindrome number"
else
echo "$1 is not an palindrome number"
fi

Is This Answer Correct ?    56 Yes 53 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is powershell a bash?

588


What makes c shell a more preferable option than the bourne shell?

534


What is path in shell script?

636


Is bash an operating system?

542


Write down the syntax of "for " loop

607






What are the advantages of using shell scripts?

577


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

693


How to debug the problems encountered in the shell script/program?

626


What is the first line in a shell script?

553


Is bash a shell script?

597


Why is the use of shell script?

541


What is the use of echo in shell script?

537


Given a file find the count of lines containing the word "abc".

950


What is the difference between bash and shell?

641


Why do we write bin bash in shell scripts?

546