Shell script convert the given amount into words, Programming Languages

 Convert the given amount into words.

 

echo -e "Enter the amount: \c"

read amt

temp=`grep $amt rupees.txt | wc -l`

if test $temp -gt 0

then

grep -w $amt rupees.txt | cut -d " " -f2

else

rw=""

len=`echo "$amt" | wc -c`

i=1

while test $i -lt $len

do

  temp=`echo "$amt" | cut -c$i`

  if test $i -eq 1

 then

 if test $amt -gt 10

then

 temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | tail -n1`

 rw=`echo "$rw $temp"`

else

temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | head -n1`

 rw=`echo "$rw $temp"`

fi

else

temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | head -n1`

 rw=`echo "$rw $temp"`

 

fi

  i=`expr $i + 1`

done

echo $rw

fi

 

Output

Enter the amount: 66

Sixty Six

Enter the amount: 15

Fifteen

 

Posted Date: 9/26/2012 8:40:12 AM | Location : United States







Related Discussions:- Shell script convert the given amount into words, Assignment Help, Ask Question on Shell script convert the given amount into words, Get Answer, Expert's Help, Shell script convert the given amount into words Discussions

Write discussion on Shell script convert the given amount into words
Your posts are moderated
Related Questions
Determine the address accessed by each of the following instruction if DS=1100H, BX=0200H, LIST=0250H AND SI=0500H-: 1) MOV LIST[SI],EDX?0250+0500+11000=11750 2

I''m doing a project for class in college and im supposed to use today''s date and figure out how old i am in months, days, minutes, and seconds. My question is what is the beset

Difference between java and j2ee programming In the basic form, the phrase java is placed as a selection terminology. On the other hand, the phrase J2EE is placed as a renderin

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

program take integer from user and print in alphabets

code for using tree view control and fill it with database

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

The objectives of this assignment are to test your ability to create XML documents to contain well-defined information. This assignment will be used further in Assignment 2, so ple

I need someone to make an ER diagram.

Attributes to Elements Create an XSLT stylesheet that converts all attributes found in a given XML document to elements.Use the sample instance from question 2 to test the tra