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

Tell something about the super block in shell scripting?

1083


Explain about login shell?

1168


What is the equivalent of a file shortcut that we have a window on a linux system?

1176


Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.

2261


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

1036


How do I set bash as default shell mac?

1051


shell script for reverse the string

1453


What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?

1115


What is computer cli?

953


What does .sh file contain?

998


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.

1324


What is shell geeksforgeeks?

1173


madhar chod unix ke 10 commands dhang se likh nahi sakta hai

3520


What is batch file programming?

1202


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

1219