#!/bin/bash --
#
dirdirname=`dirname "$0" | sed -e 's|/bin$||'`
if [ $? -ne 0 ]; then exit 1; fi

cd "$dirdirname"
if [ $? -ne 0 ]; then exit 2; fi

if [ ! -L datadir-on-local-filesystem ]; then exit 3; fi
if [ ! -d datadir-on-local-filesystem/ ]; then exit 4; fi
if [ ! -x bin/bitcoin-cli ]; then exit 5; fi

if [ $# -eq 0 ]; then
	exec bin/bitcoin-cli
else
	exec bin/bitcoin-cli -datadir=datadir-on-local-filesystem "$@"
fi
