write a shell script to identify the given string is
palindrome or not?
Answer Posted / abhijeet chavan (cts)
set -x
input_string=$1
if [ -z "$input_string" ] ; then
echo "Please enter a Text along with the script name\n"
exit
fi
reversed_string=$(rev $input-string)
if [ "$input_string" -eq "$reverse_string" ] ; then
echo "The String $input_String is a Palindrome"
else
echo "This string is not a palindrome"
fi
| Is This Answer Correct ? | 49 Yes | 51 No |
Post New Answer View All Answers
What is basename in shell script?
How to write a function?
What are script files?
How do I open the shell in cmd?
Can shell script run on windows?
What are the 3 standard streams in linux?
Is cmd a shell?
Why are shell scripts used?
Why is the use of shell script?
What is $1 in shell scripting?
What is the significance of $#?
Which is better perl or shell scripting?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
What is sudo command?
What is the syntax of "nested if statement" in shell scripting?