write a shell script to identify the given string is
palindrome or not?
Answer Posted / dhyan@addiction
# PROGRAM TO FIND OUT WHETHER THE A INPUTED STRING IS
PALINDROME OR NOT.
echo -n "Please enter a string: "
read input_string
echo $input_string >> temp
reversed_string="$(rev temp)"
if [ $input_string = $reversed_string ]
then
echo -e "The string$input_string is palindrome\n"
else
echo -e "This string is not palindrome\n"
fi
rm temp #to use same file again and again
Is This Answer Correct ? | 2 Yes | 6 No |
Post New Answer View All Answers
What is shell prompt?
What is echo $shell?
How do I read a .sh file?
write a shell script to check the failed jobs?
What is a file basename?
What is eval in shell script?
What does egrep mean?
What is bash command used for?
What is shell chemistry?
How will you print the login names of all users on a system?
Is shell and terminal the same?
What are types of shells?
How does ls command work?
What language is bash?
Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.