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 is awk in shell script?
Write the syntax for "if" conditionals in linux?
How to calculate the number of passed arguments?
What is a shell made of?
Is shell scripting easy to learn?
How do I edit a .sh file?
What is path in shell script?
Is powershell a bash?
Write a shell script to get current date, time, user name and current working directory.
What is a boot block?
c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l
What is basename in shell script?
What are the different types of variables used in shell script?
What is shell scripting?
What is sed in shell script?