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
Write a program that takes names of 5 students in 2D Character Array and their GPAs in 1D array. Arrange the names in alphabetical order and display on screen along with GPA.

We will be assuming here that our roots are of the form, in this case, r 1,2 = l + mi If we take the first root we'll find the following solution. x l + m i It i

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

Really urgent help needed with Javascript. I have this website: I">https://www.theppcpresents.com/globe13/#/home I need to remove the video on the slider so that it only sho

1. A readme.txt file with: a. Instructions on how to compile and run your client and server code on the command line. (Also provide shell scripts if the commands are complicated

Write a program to draw the truck following figure. The program should buttons to provide When the truck runs left wheels must rotate in the correct direction. Rotating whe

This assignment begins software tools and techniques for structuring complex programs. Use it to become familiar with these facilities, and ensure you use the speci?ed concepts in

#1. Every mathematics student likes primes numbers. Every mathematics student like parabolas. Let''s put them together to have some fun: Consider two natural numbers a and b. Of co

As an XML expert you are required to model a system for an online bookshop. After an interview with the shop manager you have the following information: The detail of th

2. Design an ER diagram for an IT training group database that will meet the information need’training programme. Clearly indicate the entities, relationships and the key constrain