if [ -z $1 ]; then logger "$0: blank FROM currency" exit fi if [ -z $2 ]; then logger "$0: blank TO currency" exit fi # Only bother downloading if it's more than 3 hours old if [ $(find ~/.cache/"$1$2" -mmin +180) ] ; then rate=$(curl "http://rate-exchange-1.appspot.com/currency?from=$1&to=$2" | jshon -e rate) echo "$1$2: $rate" > ~/.cache/"$1$2" fi