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 is shell terminal?
What are the four fundamental components of every file system on linux?
What is shell scripting?
Is cmd a shell?
Write a command sequence to find the count of each word?
What is the use of echo in shell script?
How do I open the shell in cmd?
What is subshell?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
What is an inode block?
I want to connect to a remote server and execute some commands, how can I achieve this?
What is option in shell script?
What is shell company all about?
How do you find out What is your shell?
What are different types of shell?