diff --git a/home/.zshrc.local b/home/.zshrc.local index 4d47f9e..71bfa23 100644 --- a/home/.zshrc.local +++ b/home/.zshrc.local @@ -138,6 +138,16 @@ function wp() { ) } +function currency() { + ( + amount=${1:-1} + fromcurrency=${2:-USD} + tocurrency=${3:-EUR} + rate=$(curl -s "https://api.exchangeratesapi.io/latest?base=$fromcurrency&symbols=$tocurrency"|jq ".rates.$tocurrency") + printf "$amount $fromcurrency: %.02f $tocurrency\n" $(($amount * $rate)) + ) +} + # Program aliases/env ## Aliases for programs