write a shell script to identify the given string is
palindrome or not?
Answer Posted / prasath
echo"to check whether given string is palindrom or not"
echo"Enter the string"
read str
Len=$(echo "$str"| wc -c
while [$len -gt 0]
do
ch=$(echo "$str"| cut -c $len)
echo -n "$ch"
s1=$s1$ch
Len =`expr $len -1`
done
echo""
if [$s1 != $str]
Then
echo "Tha string is not palindrom"
else
echo"The string is palindrom"
fi
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is meant by $1 in shell script?
How to print all array elements and their respective indexes?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
What is a program shell?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
What is option in shell script?
How do I open the shell prompt?
How do I set bash as default shell mac?
How to print all the arguments provided to the script?
What does $@ mean bash?
When should shell programming/scripting not be used?
What is bash eval?
What command needs to be used to take the backup?
What is the way to do multilevel if-else's in shell scripting?
Write down the syntax for all the loops in shell scripting.