mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 05:04:34 +00:00
Handle BTC value not available
This commit is contained in:
parent
88de83d7d9
commit
a8f1442b43
|
@ -1,7 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
BTC_DATA=$(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null)
|
BTC_DATA=$(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null | echo 'ERR')
|
||||||
BTC_PRICE=$(echo $BTC_DATA | jq -r ".bpi.USD.rate_float")
|
|
||||||
BTC_PRICE=$(printf "%.2f" "$BTC_PRICE")
|
if [ "$BTC_DATA" != "ERR" ]; then
|
||||||
|
BTC_PRICE=$(echo $BTC_DATA | jq -r ".bpi.USD.rate_float")
|
||||||
|
BTC_PRICE=$(printf "%.2f" "$BTC_PRICE")
|
||||||
|
echo \$"$BTC_PRICE"
|
||||||
|
else
|
||||||
|
echo "N/A"
|
||||||
|
fi
|
||||||
|
|
||||||
echo \$"$BTC_PRICE"
|
|
||||||
|
|
Loading…
Reference in a new issue