write a shell script to identify the given string is
palindrome or not?
Answer Posted / shashank gonte
#!/bin/sh
if [ $# -eq 1 ] #accept input through as parameter to #
command
then
echo $1 > temporary.txt #store input to a file
if [ `cat temporary.txt` = `rev temporary.txt` ]
then
echo -e "\n\n$1 is pelindrome\n\n"
else
echo -e "\n\n$1 is not pelindrome\n\n"
fi
rm temporary.txt #remove temporary created file
else #input validation for only one parameter accepted
echo -e "\n\ninvalid no of argument please enter
only one string argument\n\n"
exit 0
fi
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
Why do we use shell scripting?
Is bash a shell script?
Explain about sourcing commands?
What does $$ mean in shell script?
How are shells born?
how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
What's the difference between scripting and coding?
Please give me example of " at command , contrab command " how to use
How to pass an argument to a script?
How will you find the 99th line of a file using only tail and head command?
what is info area how many types?
What is shell company all about?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
What lives in a shell?