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
This section is proposed to be a catch all for several of the fundamental concepts which are used occasionally in working with systems of differential equations. There will not be

Shopping Cart Purpose – Allows user to browse while keeping track of the items in which they will purchase at the end on the order page link and this will give a final price for al

Is there one can help me in the language Lisp and Prolog

Consider the following schema (DTD) and sample instance document: name    ID      #REQUIRED spouse  IDREF   #IMPLIED job     CDATA   #IMPLIED > ]>

1- Allocate array with 32bit 100 element 2- Prompt the user to enter the maximum or the upper bound of the random value 3- Read the value and use it generate random numbers to init

I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

Write your own version of the strcmp function string_compare. Supply a main program that will test each of the 3 differing outcomes. int string_compare(char *s, cha

Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

Do you do APL programs ?

1 Problem Description The task of the assignment is to build a book recommendation system for Auer Libraries. The system is to be implemented in Prolog and as the owners of t