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 script?
How do I read a .sh file?
What is computer cli?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
Explain about "s" permission bit in a file?
State the advantages of shell scripting?
Can shell script run on windows?
How do I open a jshell in cmd?
How do scripts work?
Explain about stdin, stdout and stderr?
How to print all the arguments provided to the script?
Can you write a script to portray how set –x works?
What language is bash?
how will you find the total disk space used by a specific user?
What is the conditional statement in shell scripting?