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
Which shell is the best?
What is the use of "$?" Sign in shell script?
Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.
What will happen to my current process when I execute a command using exec?
How do I debug a shell script?
What is shell and terminal?
What is path variable bash?
What does sh mean?
How to find duplicate record in file using shell script?
What is a batch file used for?
What is the way to do multilevel if-else's in shell scripting?
How will you emulate wc –l using awk?
How does path variable work?
What does chmod do?
Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.