]> granicus.if.org Git - postgresql/commitdiff
Put quotes around environment variables.
authorBruce Momjian <bruce@momjian.us>
Sun, 21 Jan 2001 05:16:45 +0000 (05:16 +0000)
committerBruce Momjian <bruce@momjian.us>
Sun, 21 Jan 2001 05:16:45 +0000 (05:16 +0000)
src/bin/scripts/createdb
src/bin/scripts/createlang.sh
src/bin/scripts/createuser
src/bin/scripts/droplang
src/bin/scripts/dropuser

index 3937b619138dd8e720071066d85ef3bfb451bdf6..037566a528a6d54b0b1bc0b2ba11a4f4065fed71 100644 (file)
@@ -11,7 +11,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.12 2000/11/25 19:05:44 petere Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.13 2001/01/21 05:16:45 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -73,19 +73,19 @@ do
                dbpath="$2"
                shift;;
         -D*)
-                dbpath=`echo $1 | sed 's/^-D//'`
+                dbpath=`echo "$1" | sed 's/^-D//'`
                 ;;
         --location=*)
-                dbpath=`echo $1 | sed 's/^--location=//'`
+                dbpath=`echo "$1" | sed 's/^--location=//'`
                 ;;
        --encoding|-E)
-               MB=$2
+               MB="$2"
                shift;;
         -E*)
-                MB=`echo $1 | sed 's/^-E//'`
+                MB=`echo "$1" | sed 's/^-E//'`
                 ;;
         --encoding=*)
-                MB=`echo $1 | sed 's/^--encoding=//'`
+                MB=`echo "$1" | sed 's/^--encoding=//'`
                 ;;
        -*)
                echo "$CMDNAME: invalid option: $1" 1>&2
@@ -138,7 +138,7 @@ fi
 
 if [ -z "$dbname" ]; then
         if [ "$PGUSER" ]; then
-                dbname=$PGUSER
+                dbname="$PGUSER"
         else
                 dbname=`${PATHNAME}pg_id -u -n`
         fi
@@ -147,8 +147,8 @@ fi
 
 
 # escape the quotes
-dbpath=`echo $dbpath | sed "s/'/\\\\\'/g"`
-dbname=`echo $dbname | sed 's/\"/\\\"/g'`
+dbpath=`echo "$dbpath" | sed "s/'/\\\\\'/g"`
+dbname=`echo "$dbname" | sed 's/\"/\\\"/g'`
 
 withstring=
 [ "$dbpath" ] &&     withstring="$withstring LOCATION = '$dbpath'"
@@ -164,7 +164,7 @@ fi
 # Insert comment as well, if requested
 [ -z "$dbcomment" ] && exit 0
 
-dbcomment=`echo $dbcomment | sed "s/'/\\\\\'/g"`
+dbcomment=`echo "$dbcomment" | sed "s/'/\\\\\'/g"`
 
 ${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
 if [ $? -ne 0 ]; then
index db4189bd0724e1c0bc78695c85e849d2d95a3cb8..20ec9cd4b3f6a701a19d9cacf8b7b51d5cb23a87 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.21 2000/11/25 19:05:44 petere Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.22 2001/01/21 05:16:45 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -81,20 +81,20 @@ do
                dbname="$2"
                shift;;
         -d*)
-                dbname=`echo $1 | sed 's/^-d//'`
+                dbname=`echo "$1" | sed 's/^-d//'`
                 ;;
         --dbname=*)
-                dbname=`echo $1 | sed 's/^--dbname=//'`
+                dbname=`echo "$1" | sed 's/^--dbname=//'`
                 ;;
 # misc options
        --pglib|-L)
                 PGLIB="$2"
                 shift;;
         -L*)
-                PGLIB=`echo $1 | sed 's/^-L//'`
+                PGLIB=`echo "$1" | sed 's/^-L//'`
                 ;;
         --pglib=*)
-                PGLIB=`echo $1 | sed 's/^--pglib=//'`
+                PGLIB=`echo "$1" | sed 's/^--pglib=//'`
                 ;;
 
        -*)
index 37a763680557df3770fae43d1ede4dc86bde69e1..8705c53340f178308989b889546e36752795ef3c 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.15 2000/11/25 19:05:44 petere Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.16 2001/01/21 05:16:45 momjian Exp $
 #
 # Note - this should NOT be setuid.
 #
@@ -97,13 +97,13 @@ do
                CanAddUser=f
                ;;
         --sysid|-i)
-                SysID=$2
+                SysID="$2"
                 shift;;
         --sysid=*)
-                SysID=`echo $1 | sed 's/^--sysid=//'`
+                SysID=`echo "$1" | sed 's/^--sysid=//'`
                 ;;
         -i*)
-                SysID=`echo $1 | sed 's/^-i//'`
+                SysID=`echo "$1" | sed 's/^-i//'`
                 ;;
        --pwprompt|--pw|-P)
                PwPrompt=t
@@ -114,7 +114,7 @@ do
                exit 1
                ;;
          *)
-               NewUser=$1
+               NewUser="$1"
                ;;
     esac
     shift;
@@ -182,14 +182,14 @@ if [ "$PwPrompt" ]; then
             echo "Passwords didn't match." 1>&2
             exit 1
         fi
-       Password=$FirstPw
+       Password="$FirstPw"
 fi
 
 if [ -z "$CanCreateDb" ]; then
        $ECHO_N "Shall the new user be allowed to create databases? (y/n) "$ECHO_C
        read REPLY
        [ $? -ne 0 ] && exit 1
-       if [ $REPLY = "y" -o $REPLY = "Y" ]; then
+       if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
                CanCreateDb=t
        else
                CanCreateDb=f
@@ -200,7 +200,7 @@ if [ -z "$CanAddUser" ]; then
        $ECHO_N "Shall the new user be allowed to create more new users? (y/n) "$ECHO_C
        read REPLY
        [ $? -ne 0 ] && exit 1
-       if [ $REPLY = "y" -o $REPLY = "Y" ]; then
+       if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
                CanAddUser=t
        else
                CanAddUser=f
@@ -211,8 +211,8 @@ fi
 #
 # build SQL command
 #
-NewUser=`echo $NewUser | sed 's/\"/\\\"/g'`
-Password=`echo $Password | sed 's/\"/\\\"/g'`
+NewUser=`echo "$NewUser" | sed 's/\"/\\\"/g'`
+Password=`echo "$Password" | sed 's/\"/\\\"/g'`
 
 QUERY="CREATE USER \"$NewUser\""
 
index 43154b2e7d8ec1e9034c4822f6340d9d280fde4b..ea4a00f9f6b3d405e92ec29e3dbef55e0f072b28 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.11 2000/11/25 19:05:44 petere Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.12 2001/01/21 05:16:45 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -81,10 +81,10 @@ do
                dbname="$2"
                shift;;
         -d*)
-                dbname=`echo $1 | sed 's/^-d//'`
+                dbname=`echo "$1" | sed 's/^-d//'`
                 ;;
         --dbname=*)
-                dbname=`echo $1 | sed 's/^--dbname=//'`
+                dbname=`echo "$1" | sed 's/^--dbname=//'`
                 ;;
 
        -*)
@@ -203,7 +203,7 @@ if [ $? -ne 0 ]; then
        echo "$CMDNAME: external error" 1>&2
        exit 1
 fi
-if [ $res -ne 0 ]; then
+if [ "$res" -ne 0 ]; then
        echo "$CMDNAME: There are $res functions/trigger procedures declared in language" 1>&2
         echo "$lancomp. Language not removed." 1>&2
        exit 1
index 21e71d870585b14ed5e5c5f3077f46f892dc95b7..fc7f66af433ca5d284c7ef5b35cf38cf992b02c8 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.10 2000/11/25 19:05:44 petere Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.11 2001/01/21 05:16:45 momjian Exp $
 #
 # Note - this should NOT be setuid.
 #
@@ -134,7 +134,7 @@ if [ "$forcedel" = f ]; then
 fi
 
 
-DelUser=`echo $DelUser | sed 's/\"/\\\"/g'`
+DelUser=`echo "$DelUser" | sed 's/\"/\\\"/g'`
 
 ${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""