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 will you pass and access arguments to a script in linux?
Write the syntax for "if" conditionals in linux?
Explain how you Automate your application using Shell scripting.
Write down the syntax for all the loops in shell scripting.
What does egrep mean?
how to get part of string variable with echo command only?
I have 2 files and I want to print the records which are common to both.
What is shell and terminal?
What does echo mean in scripting?
Why is used in shell scripting?
What are the different types of shell scripting?
Explain about echo command?
How can the contents of a file inside jar be read without extracting in a shell script?
How to pass an argument to a script?
State the advantages of shell scripting?