From a14bf40b886b93a04ca053d19813e9fa2d7010e2 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 3 Oct 1996 00:23:42 +0000 Subject: [PATCH] Added new single-letter options to initdb.sh. Removed long-option names that used ${#} shell feature which was a compatability problem. --- src/bin/initdb/initdb.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh index 6c32050f38..e221dee874 100644 --- a/src/bin/initdb/initdb.sh +++ b/src/bin/initdb/initdb.sh @@ -26,7 +26,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.6 1996/09/23 08:23:17 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.7 1996/10/03 00:23:42 momjian Exp $ # #------------------------------------------------------------------------- @@ -57,24 +57,28 @@ noclean=0 template_only=0 POSTGRES_SUPERUSERNAME=$USER -for ARG ; do - if [ $ARG = "--debug" -o $ARG = "-d" ]; then +while [ "$#" -gt 0 ] +do + if [ "$1" = "-d" ]; then debug=1 echo "Running with debug mode on." - elif [ $ARG = "--noclean" -o $ARG = "-n" ]; then + elif [ "$1" = "-n" ]; then noclean=1 echo "Running with noclean mode on. Mistakes will not be cleaned up." - elif [ $ARG = "--template" ]; then + elif [ "$1" = "-t" ]; then template_only=1 echo "updating template1 database only." - elif [ ${ARG#--username=} != $ARG ]; then - POSTGRES_SUPERUSERNAME=${ARG,"--username="} - elif [ ${ARG#--pgdata=} != $ARG ]; then - PGDATA=${ARG#--pgdata=} + elif [ "$1" = "-u" ]; then + shift + POSTGRES_SUPERUSERNAME="$1" + elif [ "$1" = "-r" ]; then + shift + PGDATA=$1 else - echo "initdb [--template] [--debug] [--noclean]" \ - "[--username=SUPERUSER] [--pgdata=DATADIR]" + echo "initdb [-t] [-d] [-n] [-u superuser] [-r datadir]" 1>&2 + exit 1 fi + shift done if [ "$debug" -eq 1 ]; then