Skip to content

Instantly share code, notes, and snippets.

@james-see
Created August 9, 2016 03:31
Show Gist options
  • Select an option

  • Save james-see/60429cc7327065490c036ad5b6378884 to your computer and use it in GitHub Desktop.

Select an option

Save james-see/60429cc7327065490c036ad5b6378884 to your computer and use it in GitHub Desktop.
bitcoin balance checker from bash
echo "|||**** BITBALANCE ****|||"
echo "||| Wallet to check: "
read bitwallet
echo "You entered: $bitwallet"
curl --silent "https://blockchain.info/address/$bitwallet?format=json" > balance.txt &
pid=$!
spin[0]="-"
spin[1]="\\"
spin[2]="|"
spin[3]="/"
echo "[processing wallet balance] ${spin[0]}"
i=1
sp="/-\|"
echo ' '
while ps -p $pid > /dev/null;
do
printf "\b${sp:i++%${#sp}:1}"
done
clear
bitbalance=$(cat balance.txt | grep "balance" | sed 's/,$//' | sed 's/.*://')
bitbalancefix=$(bc -l <<< "$bitbalance/100000000")
printf "Balance for Wallet $bitwallet is:"
printf "%.6f", "$bitbalancefix"
@james-see
Copy link
Author

added a nice spinner in there to whistle while you work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment