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


Please Help Members By Posting Answers For Below Questions

What is shell prompt?

568


What is echo $shell?

628


How do I read a .sh file?

539


write a shell script to check the failed jobs?

3964


What is a file basename?

604






What is eval in shell script?

657


What does egrep mean?

583


What is bash command used for?

593


What is shell chemistry?

548


How will you print the login names of all users on a system?

583


Is shell and terminal the same?

602


What are types of shells?

560


How does ls command work?

592


What language is bash?

498


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.

810