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
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
How will you print the login names of all users on a system?
What does $$ mean in shell script?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
How to set an array in linux?
What is a program shell?
What is @echo off?
Explain about the slow execution speed of shells?
How do I run a shell script on a mac?
Can shell script run on windows?
What is the syntax of while loop in shell scripting?
What is bash shell command?
What are script files?
How do I open the shell prompt?
What is the conditional statement in shell scripting?