Sipgate-CLI/getbalance.sh
Gandalf e94b3dc78e Usability
Muss ja kein rohes JSON anzeigen…
2021-03-04 19:44:27 +01:00

6 lines
370 B
Bash
Executable file

BAL=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/balance" -s)
AMOUNT=$(echo $BAL | jq '.amount')
CUR=$(echo $BAL | jq '.currency' | sed -e 's:"::g' )
AMOUNT=$(echo "scale=2; $AMOUNT/10000" | bc -l)
echo "Your current balance is "$CUR $AMOUNT