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

Assignment Help:

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


Related Discussions:- Shell script to check a given string is palindrome or not

Shell script to display system time in words, Normal 0 false ...

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

Shell script to remove colons from a colon–separated record, Normal 0 ...

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

Python (using os.walk), Using os.walk, write a script that will print the f...

Using os.walk, write a script that will print the filenames of zero length files. It should also print the count of zero length files.

Wap for intelligent agent able to play block dominoes game, Objective: ...

Objective: In a programming language of your choice, write an intelligent agent able to play block Dominoes against a player. Together with this assignment you will find two pa

Prolog assignment, I have constantly been emailing to get the task i had pa...

I have constantly been emailing to get the task i had paid for to be done correctly but no replies from anyone. Not even one acknowledging my emails. Been phoning all the way from

Sizes of the clusters influence-k-means program, Objective: to show if th...

Objective: to show if the sizes of the clusters influence the communication cost among a set on nodes Write a K-Means  program  for a set of M points randomly distributed on an

Double roots, This case will lead to similar problem that we've had all oth...

This case will lead to similar problem that we've had all other time we've run in double roots or double eigenvalues. We only find a single solution and will require a second solut

Draw data structure and analyse on xml, The scenario As an XML expert y...

The scenario As an XML expert you are required to model a system for an online furniture shop. After an interview with the shop manager you have the following information: T

Write a prolog predicate has duplicates, Write a Prolog predicate has_dupli...

Write a Prolog predicate has_duplicates(L) that is true if list L contains duplicated elements (that is at least 2 copies of an element). For instance: ?- has_duplicates([a,e,b,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd