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
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 is bash coding?
Given a file find the count of lines containing the word "abc".
What is a batch file used for?
How can the contents of a file inside jar be read without extracting in a shell script?
Is shell and terminal the same?
Differentiate between ‘ and ” quotes.
What is sudo command?
How to redirect both standard output and standard error to the same location?
What language is bash written in?
What language is used in terminal?
Is shell scripting useful?
What are the different commands available to check the disk usage?
What is the syntax of "nested if statement" in shell scripting?
What can scripts do?