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
Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

What is Data Normalization and Schema Refinement? Define briefly..

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

An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase. For example the anagram of tea is tea, tae, eat, eta,

You must use the keyword ''var'' to create and initialize a variable. The placement of the variable creation in your code is very important. Examples: var first = 21; var secon

How Can I Retrive Unicode CSV File the ADO.net VB.net

Question 1 How to call a WML Script from a WML Page? Question 2 Write short notes on WML Script Operators and Expressions Question 3 Write short notes on WML Script Statements

PLEASE HELP ME ORACLE PROGRAMING TRIGGER

Define the The if statement - Computer Programming? The if statement is an influential selection statement and is used to control the flow of execution of statements. One of th

For this assignment you will need to design and construct a basic math program which targets elementary school children. Your program must adhere to the following steps and require