#!/bin/rc date=() switch ($1) { case -help --help echo 'Usage: currency [-d mm/dd/yyyy] gbp cad # gives value of pound in $C' exit case -d date=$2 shift 2 } switch ($#*) { case 0 xin=gbp xout=cad case 1 xin=gbp xout=$1 case * xin=$1 xout=$2 } xin=`{echo $xin|tr a-z A-Z} xout=`{echo $xout|tr a-z A-Z} switch ($#date) { case 0 now=`{date} months=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) for (i in `{seq 1 12}) { if (~ $now(2) $months($i)) date=$i } date=$date^'/'^$now(3)^'/'^$now(6) } hget 'http://www.oanda.com/convert/classic?user=printable&exch='$xout'&expr='$xin'&value=1&date_fmt=us&date='$date | grep '^[ ]*1 '