![]()
#!/bin/sh
#currconv: currency converter
case $# in
3) ;;
*) 1>&2 echo "currconv: currconv amount from to"; exit 1;;
esac
lynx -dump -cookies -cmd_script=$HOME/scripts/xe.com.lynx "http://www.xe.com/ucc/convert.cgi?Amount=$1&From=$2&To=$3" | sed -n '/Live/{n;p;n;p;n;p;n;p;n;p;}'
#!/bin/sh
#weightconv: weights & measures converter
progname=`basename $0`
table=/usr/local/lib/weights_and_measures
case $# in
0|1) echo "$progname: usage weightconv amount from [to]" 1>&2; exit 1;;
esac
amount=$1
from=$2
to=$3
rate=`grep "^$from $to" $table|awk '{print $3}'`
case $rate in
"") echo "$progname: no rate found for $from to $to" 1>&2; exit 2;;
esac
echo $amount $rate | awk '{print $1*$2}'
#!/bin/sh
#weightconv: weights & measures converter
table=/usr/local/lib/weights_and_measures
case $# in
0|1) echo "weightconv: usage weightconv amount from [to]" 1>&2; exit 1;;
esac
amount=$1
from=$2
to=$3
rate=`grep "^$from $to" $table|awk '{print $3}'`
case $rate in
"") echo "weightconv: no rate found for $from to $to" 1>&2; exit 2;;
esac
echo $amount $rate | awk '{print $1*$2}'
[back to Scripts index] [back to Linux, Unix, etc] [Main Site] [Weblog]
Contents licensed under the GPL