123456789101112131415161718192021222324252627 |
- #!/bin/bash
-
- . $(ffoom path)
-
- ffoo import pretty
-
- uri='https://www.cnb.cz/en/financial_markets/foreign_exchange_market/exchange_rate_fixing/daily.txt'
-
- get_field() {
- local wntcur=$1
- local wntfld=${2:-Rate}
- local fldn
- case "$wntfld" in
- Country|Currency|Amount|Code|Rate) true;;
- *) usage_is "code Country|Currency|Amount|Code|Rate" ;;
- esac
- local date head
- read date
- read head
- IFS='|'; while read Country Currency Amount Code Rate;
- do
- test "$wntcur" = "$Code" && echo ${!wntfld}
- done
- }
-
- curl --insecure --silent "$uri" \
- | get_field ${1:-USD} Rate
|