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


Click here to return to the 'A TRUE One-Liner for Those without Lynx, etc' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A TRUE One-Liner for Those without Lynx, etc
Authored by: nicksay on Jul 10, '05 10:09:01PM
So I came up with an more condensed version of my currency function from above. This one takes advantage of a different Yahoo API that gives straight CSV text and skips having to parse all that html.
currency() { printf "$1 $2 = %.4f $3\n" $(echo "$1 * "$(curl -s \
"http://finance.yahoo.com/d/quotes.csv?s=${2}${3}=X&f=l1" | tr -Cd "0-9.") | bc); }
As before, it's on two lines for legibility, with the line-break preceded by a back-slash. Remove the line-break and the back-slash. Stick it in your .profile and use via:
currency AMOUNT FROM TO
example:
currency 1 USD EUR


[ Reply to This | # ]