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


Please Help Members By Posting Answers For Below Questions

What is mac default shell?

614


How to print all array elements and their respective indexes?

503


Print the 10th line without using tail and head command.

1674


What's the difference between scripting and coding?

595


How will you connect to a database server from linux?

555






What are the two files of crontab command?

652


how will you find the total disk space used by a specific user?

578


How do you find out What is your shell?

590


What is the significance of $#?

588


What is computer cli?

497


Explain about sourcing commands?

635


What is shell scripting used for?

570


Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

935


What is the significance of the shebang line in shell scripting?

529


What is a shell script? Can you name some of its advantages?

525