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

Answer Posted / siva

echo "PALINDROME NUMBER"
echo "ENTER THE NUMBER :"
read n
n1=$n
rev=0
while [ $n1 -ne 0 ]
do
rem=`expr $n1 % 10`
n1=`expr $n1 / 10`
rev=`expr $rem + $rev \* 10`
done
if [ $n -eq $rev ]
then
echo $n is a Palindrome Number
else
echo $n is not a Palindrome Number
fi

PALINDROME NUMBER
ENTER THE NUMBER :
121
121 is a Palindrome Number
$sh palno.sh
PALINDROME NUMBER
ENTER THE NUMBER :
123
123 is not a Palindrome Number

Is This Answer Correct ?    24 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

4690


How will you print the login names of all users on a system?

570


What does $$ mean in shell script?

579


Suppose you execute a command using exec, what will be the status of your current process in the shell?

578


How to set an array in linux?

595






What is a program shell?

570


What is @echo off?

560


Explain about the slow execution speed of shells?

773


How do I run a shell script on a mac?

625


Can shell script run on windows?

562


What is the syntax of while loop in shell scripting?

569


What is bash shell command?

557


What are script files?

548


How do I open the shell prompt?

571


What is the conditional statement in shell scripting?

657