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 / akshay telang

#! /usr/bin/ksh
string=$1
str1=$1
pal=""
typeset -R1 last

while ((${#string})) ; do
last=$string
pal=${pal}${last}
if ((${#string} > 1)) ; then
typeset -L$((${#string}-1)) oneLess=$string
string=$oneLess
else
string=
fi
done
if [ "$str1" == "$pal" ]
then
echo "String is a Palindrome"
else
echo "String is not a Palindrome"
fi

Is This Answer Correct ?    24 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is awk in shell script?

1274


Write the syntax for "if" conditionals in linux?

1161


How to calculate the number of passed arguments?

1168


What is a shell made of?

1003


Is shell scripting easy to learn?

1071


How do I edit a .sh file?

1208


What is path in shell script?

1141


Is powershell a bash?

1127


Write a shell script to get current date, time, user name and current working directory.

1132


What is a boot block?

1084


c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l

3841


What is basename in shell script?

1102


What are the different types of variables used in shell script?

1140


What is shell scripting?

1098


What is sed in shell script?

1103