From: Sebastian Harl Date: Mon, 30 Apr 2012 14:29:31 +0000 (+0200) Subject: pgtest.sh: Pass additional arguments to client and start. X-Git-Url: https://git.tokkee.org/?p=postrr.git;a=commitdiff_plain;h=230d094cde2778ba3168f33be7fd02053fec6187 pgtest.sh: Pass additional arguments to client and start. Also, check for any additional arguments in all other commands. --- diff --git a/pgtest.sh b/pgtest.sh index b88bf6c..692de5e 100755 --- a/pgtest.sh +++ b/pgtest.sh @@ -44,6 +44,11 @@ set -e case "$1" in setup) + if test $# -ne 1; then + echo "Too many arguments!" >&2 + echo "Usage: $0 setup" >&2 + exit 1 + fi mkdir -p $TARGET/var/lib/postgresql/main mkdir -p $TARGET/var/run/postgresql mkdir -p $TARGET/var/log/postgresql/main @@ -66,16 +71,24 @@ case "$1" in export LD_PRELOAD="$LD_PRELOAD:$libreadline" fi fi - $BIN_DIR/psql -h $TARGET/var/run/postgresql/ -p 5435 + shift + $BIN_DIR/psql -h $TARGET/var/run/postgresql/ -p 5435 "$@" ;; stop) + if test $# -ne 1; then + echo "Too many arguments!" >&2 + echo "Usage: $0 setup" >&2 + exit 1 + fi $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main stop ;; start) - if test "$2" = "-B"; then - $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main -l logfile -w start + shift + if test "$1" = "-B"; then + shift + $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main -l logfile -w start "$@" else - $BIN_DIR/postgres -D $TARGET/var/lib/postgresql/main + $BIN_DIR/postgres -D $TARGET/var/lib/postgresql/main "$@" fi ;; *)