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 $@ mean bash?
What is difference between bash and shell?
What is the meaning of $1 in shell script?
What are the two files of crontab command?
Differentiate between ‘ and ” quotes.
Explain about shebang?
What is the syntax of while loop in shell scripting?
What is echo in shell?
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
What is a shell? · Types of shell · what is shell scripting?
How to find all the files modified in less than 3 days and save the record in a text file?
What are the different communication commands available in the shell?
How do I open the shell in cmd?
What are the advantages of shell scripting?
How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?