Shell script to check a given string is palindrome or not, Programming Languages

W.A.S.S to check whether a given string is palindrome or not.

 

Program

 

# W.A.S.S to check whether a given string is palindrome or not.

#07MCG20

 

echo "Enter any string"

read str

len=`echo $str | wc -c`

len=`expr $len - 1`

result=""

while test $len -gt 0

do

temp=`echo $str | cut -c $len`

len=`expr $len - 1`

result=`echo $result$temp`

done

echo "$result"

if test "$result" = "$str"

then

echo "Given string is palimdrom"

else

echo "Given string is not palimdrom"

fi

 

Output

 

Enter any string

madam

madam

Given string is palimdrome

 

Enter any string

mca

acm

            Given string is not palimdrome

Posted Date: 9/26/2012 6:27:41 AM | Location : United States







Related Discussions:- Shell script to check a given string is palindrome or not, Assignment Help, Ask Question on Shell script to check a given string is palindrome or not, Get Answer, Expert's Help, Shell script to check a given string is palindrome or not Discussions

Write discussion on Shell script to check a given string is palindrome or not
Your posts are moderated
Related Questions
The idea of this section is not to do anything new along with a series solution problem.  Instead this is here to exemplify that moving in a higher order differential equation does

Write a program that draws the initials J G P on the form similar to that shown in Fig J 1 (using straight lines and curve semicircles). The figure can not have corners. All ends a

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4


Detailed Description: • The program will take temperature readings as input from user for specified number of consecutive days. • Program will store these temperature values into

i have 4 variables in my linkage section of PIC 9(3) ..while submitting i m passing parameter value i.e. numeic to them but its taking space for 2 varaible and for two its taking c

basic steps involved in spreadsheet developement

Given a list of numbers, say my @input_numbers = (1, 1, 3, 5, 8, 13, 21, 34, 55, 89, 144); write a program map1.pl that will use the function map (a) to produce a list of

In this assignment you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application. You