Created
July 28, 2014 19:26
-
-
Save infertux/1d963035d50fc86925ff to your computer and use it in GitHub Desktop.
bitcoin-qt wrapper to support multiple wallets
This file contains 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
#!/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