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
What are the advantages of using shell scripts?
What are the advantages of shell script?
What is scripting autism?
What is an inode block?
Explain about return code?
What will happen to my current process when I execute a command using exec?
Write a script to print the first 10 elements of fibonacci series.
How to print all array elements and their respective indexes?
Is shell a part of kernel?
What is the purpose of scripting?
Why do we write bin bash in shell scripts?
What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?
What does $$ mean in shell script?
Is cmd a shell?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?