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
What are the Functions in Computer Programming? A program is completed up of one or more functions, with one of these being main(). Function is a self-contained block of progra

(a) Write a procedure called (lookup n t). This procedure has 2 arguments: n is the value being looked up, t is the AVL tree. The subtree with n as its root is returned (or '() if

JSP QUIZ ASSIGNMENT SHOULD BE FUNCTIONAL ON ECLIPSE QUIZ HAS TOTAL 20 QUESTIONS REGARDING VARIOUS CAPITALS OF COUNTRIES. WELCOME PAGE OFFERS USER TO ENTER HIS NAME. THEN USER C

Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

Use an insertion sort to sort an array (sequence) of long word integers. The size of the list will appear just before the list itself. Use the same labels as in this example: LE

I have assignment about python language . Could you helpe me to built it

Problem: (i) Define Remote Procedure Call (RPC). (ii) Explain with diagram how RPC works? (iii) A remote procedure is uniquely defined by (a) Program number. (b)

depth estimation from block matching algorithm motion estimation

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

(a) (i) What do you meant  by a function? Are functions required when writing a C program? (ii) State one of the advantages to the use of functions. (iii) What do you meant by a