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 to get script name inside a script?
What is shell variable?
What is shell scripting used for?
Write a shell script to get current date, time, user name and current working directory.
What is the significance of the shebang line in shell scripting?
What is option in shell script?
How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?
What are the default permissions of a file when it is created?
What is shell and shell script?
What are scripts in psychology?
What is the first line in every perl script called?
Is shell scripting a programming language?
Tell something about the super block in shell scripting?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
What are types of shells?