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
What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
What are the advantages of shell scripting?
What is a scripting language simple definition?
What does $1 mean in bash?
What is a shell script in windows?
What is shell and shell script?
What are the 3 standard streams in linux?
How to print all array elements and their respective indexes?
How many fields are present in a crontab file and what does each field specify?
How do I debug a shell script?
Explain about the slow execution speed of shells?
What is an sh file?