currency (278B)
1 #!/bin/sh 2 3 [ -z $1 ] && echo "usage: $(basename $0) <amount> <input currency> in <output currency>" && exit 4 5 from="$2" 6 to="$4" 7 8 mult=$(curl -qs "https://min-api.cryptocompare.com/data/price?fsym=$from&tsyms=$to" | awk -F"[\"}{:]" '{print $5}') 9 10 echo "scale=15; $1 * $mult" | bc