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
how to create a screen for messages for a data transmission system

Implement a two-dimensional table in Prolog. Your program will contain: 1.  An insert_entry predicate that takes a table, row, column and an entry and inserts the entry at the g

Is it possible to get an assignment done within 2 hours

how do i make a bomber game using pascal on a software called lazuras

Add macros to MS word 2010 according to A PARTICULAR FORMAT

Write a function called triple (in a file called 'triple.m'). That takes a single variable x and returns a single variable in which every element of x is multiplied by 3. Make sure

What is JVM-Java Virtual Machine  A JVM stands for java virtual machine. This is virtual computer or an abstract computer that runs the complied java programs. In fact JVM is

My kinect hand cursor only works for main menu but when it goes to another page it wouldn''t work.. especially when there is for camera feed

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,

In analytical geometry, a convex polygon can be represented by the Cartesian coordinates of its vertices, x and y. Assume such data of a polygon are stored in a file called "vertic