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

Answer Posted / hemanth kadham

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 + $n1 \* 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 ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is shell and terminal the same?

682


How do I run a script on mac?

648


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

856


What are script files?

626


How many fields are present in a crontab file and what does each field specify?

679






What command needs to be used to take the backup?

622


What does $1 mean in bash?

694


How do I open a jshell in cmd?

714


What language is bash?

566


How would you compare the strings in a shell script?

634


What is the command to find out today's date?

680


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

1933


Explain about return code?

708


How will you copy a file from one machine to other?

639


Where is bash history?

587