Skip to content

Instantly share code, notes, and snippets.

@infertux
Created July 28, 2014 19:26
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 infertux/1d963035d50fc86925ff to your computer and use it in GitHub Desktop.
Save infertux/1d963035d50fc86925ff to your computer and use it in GitHub Desktop.
bitcoin-qt wrapper to support multiple wallets
#!/bin/bash -eu
shopt -s extglob # enables pattern lists like +(...|...)
###
# NOTE: Adapt constants below:
BITCOIN_BIN="/home/xxx/bitcoin-0.9.2.1-linux/bin/64/bitcoin-qt"
WALLET_PREFIX="/home/xxx/.bitcoin."
WALLETS=(coinbase kraken etc)
###
[ $# -eq 1 ] || { echo "Usage: $0 <wallet_name>" >&2; exit 1; }
CURRENT_WALLET="$1"
WALLETS_PATTERN="$(printf "|%s" "${WALLETS[@]}")"
WALLETS_PATTERN="+(${WALLETS_PATTERN:1})"
case "${CURRENT_WALLET}" in
$WALLETS_PATTERN)
$BITCOIN_BIN -datadir="${WALLET_PREFIX}${CURRENT_WALLET}";;
*)
echo "Wallet \`${CURRENT_WALLET}' not found. Valid wallets are: ${WALLETS[@]}" >&2
exit 1;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment