Skip to content

Instantly share code, notes, and snippets.

@kylegibson
Created October 12, 2011 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylegibson/1280249 to your computer and use it in GitHub Desktop.
Save kylegibson/1280249 to your computer and use it in GitHub Desktop.
Bash script to scrape current bitcoin exchange prices and update a local json file
#!/bin/bash
BTC_PATH=$1
REMOTE_URL=http://bitcoincharts.com/t/weighted_prices.json
wget -q -O $BTC_PATH.temp $REMOTE_URL
test $? -ne 0 && exit
test ! -e $BTC_PATH.temp && exit
test $(stat -c%s $BTC_PATH.temp) -lt 600 && exit
mv $BTC_PATH{.temp,}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment