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
Explain about return code?
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
What does it mean to debug a script?
How many fields are present in a crontab file and what does each field specify?
What is shell variable?
How do I debug a shell script?
What is the conditional statement in shell scripting?
determine the output of the following command: echo ${new:-variable}
What is shell terminal?
What are the different variables present in linux shell?
What does $0 mean in shell script?
What is the fastest scripting language?
What is shell scripting used for?
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
What is the best shell scripting language?