1
0
Fork 0
mirror of https://github.com/ItsDrike/dotfiles.git synced 2025-05-03 06:48:36 +00:00
dotfiles/home/.local/bin/scripts/bitcoin

12 lines
292 B
Bash
Executable file

#!/bin/sh
BTC_DATA=$(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null | echo 'ERR')
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