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
How to find all the files modified in less than 3 days and save the record in a text file?
How does ls command work?
What is the fastest scripting language?
write a shell script to check the failed jobs?
Which shell is the best?
What is the crontab?
How to redirect both standard output and standard error to the same location?
What is shell company all about?
What is a file basename?
how will you find the total disk space used by a specific user?
What is $1 in shell scripting?
c program to display the information of given file similar to givan by the unix or linux command ls -l
How do I run a shell script in powershell?
Is shell script a programming language?
Differentiate between ‘ and ” quotes.