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
You are working in charge of a group of programmers at a software company. Your task is to assess and research CORBA and to produce a report to be given to the programmers detailin

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

Write a program (calculation.ccp) to allow the user to perform an arithmetic operation on the two complex numbers entered.  The user can key in one of the four operations: addition

What is an algorithm? What are the characteristics of a good algorithm? An algorithm is defined as “a step-by-step procedure of accomplishing some task'''' An algorithm may be sh

AMCC PowerPC 440 EPx Sequoia Evaluation Kit, Embedded Linux Development Kit (ELDK), and Xenomai A. Description of the Project The project's objective is to design a set of

How to create an ER diagram?

This assignment will just focus on NookyKindle eBook orders.  That is, we'll be keeping track of the titles of eBooks and the number of orders for that particular eBook during a pa

how to store multidimensional array in a single column in mysql database using MATLAB?

The following is the process an account holder of eBroker, a discount online brokerage firm, uses to sell stocks.  The user first logs in by entering the username and password.

Question 1 What is CISC & RISC? Explain their addressing modes Question 2 Discuss the following- Design Specification of Assembler Design of Single Pass Assembler