getPriceBtcUsd.sh 249 B

123456789
  1. #!/usr/bin/env bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. BTC_PRICE=$(curl -s http://api.coindesk.com/v1/bpi/currentprice.json | jq '.bpi.USD.rate' | tr -d '"' | sed 's:\.[^|]*::g' | sed 's/,//g')
  7. printf "%0.0f\n" "${BTC_PRICE}"