Created
August 9, 2016 03:31
-
-
Save james-see/60429cc7327065490c036ad5b6378884 to your computer and use it in GitHub Desktop.
bitcoin balance checker from bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added a nice spinner in there to whistle while you work