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
Can you write a script to portray how set –x works?
How do I read a .sh file?
How does ls command work?
What is the lifespan of a variable inside a shell script?
How do I run a .sh file on mac?
How to print all array elements and their respective indexes?
Why do we use shell scripting?
How do I open a jshell in cmd?
Why is used in shell scripting?
Write down the syntax of "for " loop
Explore about environment variables?
How do I open the shell prompt?
What is scripting used for?
What is shell and shell script?
What are the different commands available to check the disk usage?