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

How to find all the files modified in less than 3 days and save the record in a text file?

616


How does ls command work?

590


What is the fastest scripting language?

554


write a shell script to check the failed jobs?

3961


Which shell is the best?

579






What is the crontab?

550


How to redirect both standard output and standard error to the same location?

642


What is shell company all about?

578


What is a file basename?

598


how will you find the total disk space used by a specific user?

584


What is $1 in shell scripting?

593


c program to display the information of given file similar to givan by the unix or linux command ls -l

1701


How do I run a shell script in powershell?

556


Is shell script a programming language?

572


Differentiate between ‘ and ” quotes.

618