Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Convert any currency via the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Convert any currency via the command line
Authored by: simonpie on Jul 07, '05 02:34:33PM
Here is my modification where curr_units.txt is simply that file. So I just copied that script in ~/.bin and the currency file in ~/.bin to. That way, using the flag -H I can get the currency list.

#!/bin/tcsh -f 

if($1 == -H) then
cat ~/.bin/curr_units.txt
else lynx -nolist -dump 'http://finance.yahoo.com/currency/convert?amt='$1'&from='$2'&to='$3'&submit=Convert' | grep $2$3 | sed -e 's/[ ]*//' | awk '{print $6}'  
endif
exit 0


[ Reply to This | # ]
Convert any currency via the command line
Authored by: powerbookg3user0 on Jul 07, '05 09:11:34PM
Hmmm… I can make it better ;)
#!/bin/tcsh -f

if($1 == -h) then
lynx -nolist -dump 'http://www.macosxhints.com/dlfiles/curr_units.txt'
else lynx -nolist -dump 'http://finance.yahoo.com/currency/convert?amt='$1'
&from='$2'&to='$3'&submit=Convert' | grep $2$3 | sed -e 's/[ ]*//' | awk '{print $6}'
endif
exit 0
Again, make sure the else line and the &from line have no break inbetween. This doesn't need a local file, but instead, lynxes it!

---
Takumi Murayama

[ Reply to This | # ]