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
What does sh mean?
Is cmd a shell?
How do you know which shell I am using?
How to print the first array element?
Why are shell scripts used?
Write a command sequence to find the count of each word?
Is shell a part of kernel?
What is the command to find out users on the system?
Explain about the slow execution speed of shells?
What is awk in shell scripting?
Explain about non-login shell files?
What is difference between shell and bash scripting?
How do I read a .sh file?
Differentiate between ‘ and ” quotes.
What happens when you type ls?