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 the first line from a file using just the terminal?
What are the various stages of a linux process it passes through?
What does the sh command do?
i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..
What is shell chemistry?
How do I read a .sh file?
What is scripting autism?
What is bash command used for?
What are the different commands available to check the disk usage?
What happens on a system call?
What is awk script?
How do I run a .sh file?
What is $1 in shell scripting?
What does $@ mean in shell?
What is the difference between scripting and coding?