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

Answer Posted / onkar

# Check wheather given number is Palindrome or Not ?
# for ex- 121 -palindrome ,123 -Not palindrome

echo "Enter Number\n"
read no
n1=$no
rev=0
while [ $n1 -ne "0" ]
do
rem=`expr $n1 % "10"`
n1=`expr $n1 / "10"`
rev=`expr $rem + $rev \* "10"`
done
if [ $no -eq $rev]
then
echo Palindrome
else
echo Not Palindrome
fi

Is This Answer Correct ?    14 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does sh mean?

622


Is cmd a shell?

599


How do you know which shell I am using?

593


How to print the first array element?

559


Why are shell scripts used?

627






Write a command sequence to find the count of each word?

544


Is shell a part of kernel?

564


What is the command to find out users on the system?

575


Explain about the slow execution speed of shells?

779


What is awk in shell scripting?

560


Explain about non-login shell files?

698


What is difference between shell and bash scripting?

551


How do I read a .sh file?

533


Differentiate between ‘ and ” quotes.

618


What happens when you type ls?

571