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
What does sh mean?
What is a scripting language simple definition?
What is shell variable?
What is web script?
How to write a function?
How do I set bash as default shell mac?
What is the use of echo in shell script?
What are types of shells?
What is another name for a bash shell script that you might see?
What are zombie processes?
Give some situations where typing error can destroy a program?
How do I run a shell script on a mac?
What is the conditional statement in shell scripting?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
What language is used in terminal?