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 / gaurav shah

clear
echo enter a string
read a
b=`expr $a | wc -c`
b=`expr $b - 1`
echo number of letter=$b
while test $b -gt 0
do
e=`expr $a | cut -c $b`
d=$d$e
b=`expr $b - 1`
done
echo the reversed string is :$d
if test $a = $d
then
echo it is a palindrome
else
echo it is not a palindrome
fi

Is This Answer Correct ?    54 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you pass and access arguments to a script in linux?

1071


Write the syntax for "if" conditionals in linux?

1051


Explain how you Automate your application using Shell scripting.

2246


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

1077


What does egrep mean?

913


how to get part of string variable with echo command only?

973


I have 2 files and I want to print the records which are common to both.

1109


What is shell and terminal?

931


What does echo mean in scripting?

954


Why is used in shell scripting?

936


What are the different types of shell scripting?

1031


Explain about echo command?

1046


How can the contents of a file inside jar be read without extracting in a shell script?

1080


How to pass an argument to a script?

1092


State the advantages of shell scripting?

1009