write a shell script to identify the given string is
palindrome or not?
Answer Posted / gaurav shah
clear
echo enter a string
read a
b=`expr $a | wc -c`
b=`expr $b - 1`
echo number of letter=$b
while test $b -gt 0
do
e=`expr $a | cut -c $b`
d=$d$e
b=`expr $b - 1`
done
echo the reversed string is :$d
if test $a = $d
then
echo it is a palindrome
else
echo it is not a palindrome
fi
Is This Answer Correct ? | 54 Yes | 21 No |
Post New Answer View All Answers
How would you compare the strings in a shell script?
How to find all the files modified in less than 3 days and save the record in a text file?
When should shell programming/scripting not be used?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
Explain about stdin, stdout and stderr?
How to set an array in linux?
How do we delete all blank lines in a file?
What is the way to do multilevel if-else's in shell scripting?
Is bash an operating system?
Explain about return code?
Is shell scripting a programming language?
What command needs to be used to take the backup?
Print the 10th line without using tail and head command.
What is in a script?
What is a batch file used for?