Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is sudo command?

973


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.

1229


What is the best shell scripting language?

951


What is awk script?

916


Write down the syntax for all the loops in shell scripting.

1077


What are the different types of commonly used shells on a typical linux system?

1001


Is bash an operating system?

930


What happens when you type ls?

928


What is another name for a bash shell script that you might see?

1416


What is scripting used for?

991


Is shell and terminal the same?

992


What is shell scripting?

988


What are scripts in psychology?

987


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

5329


Is shell script a programming language?

976