Put quotes around environment variables.

This commit is contained in:
Bruce Momjian 2001-01-21 05:16:45 +00:00
parent 11d9d2cfaa
commit d7d51bc138
5 changed files with 31 additions and 31 deletions

View File

@ -11,7 +11,7 @@
# #
# #
# IDENTIFICATION # 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" dbpath="$2"
shift;; shift;;
-D*) -D*)
dbpath=`echo $1 | sed 's/^-D//'` dbpath=`echo "$1" | sed 's/^-D//'`
;; ;;
--location=*) --location=*)
dbpath=`echo $1 | sed 's/^--location=//'` dbpath=`echo "$1" | sed 's/^--location=//'`
;; ;;
--encoding|-E) --encoding|-E)
MB=$2 MB="$2"
shift;; shift;;
-E*) -E*)
MB=`echo $1 | sed 's/^-E//'` MB=`echo "$1" | sed 's/^-E//'`
;; ;;
--encoding=*) --encoding=*)
MB=`echo $1 | sed 's/^--encoding=//'` MB=`echo "$1" | sed 's/^--encoding=//'`
;; ;;
-*) -*)
echo "$CMDNAME: invalid option: $1" 1>&2 echo "$CMDNAME: invalid option: $1" 1>&2
@ -138,7 +138,7 @@ fi
if [ -z "$dbname" ]; then if [ -z "$dbname" ]; then
if [ "$PGUSER" ]; then if [ "$PGUSER" ]; then
dbname=$PGUSER dbname="$PGUSER"
else else
dbname=`${PATHNAME}pg_id -u -n` dbname=`${PATHNAME}pg_id -u -n`
fi fi
@ -147,8 +147,8 @@ fi
# escape the quotes # escape the quotes
dbpath=`echo $dbpath | sed "s/'/\\\\\'/g"` dbpath=`echo "$dbpath" | sed "s/'/\\\\\'/g"`
dbname=`echo $dbname | sed 's/\"/\\\"/g'` dbname=`echo "$dbname" | sed 's/\"/\\\"/g'`
withstring= withstring=
[ "$dbpath" ] && withstring="$withstring LOCATION = '$dbpath'" [ "$dbpath" ] && withstring="$withstring LOCATION = '$dbpath'"
@ -164,7 +164,7 @@ fi
# Insert comment as well, if requested # Insert comment as well, if requested
[ -z "$dbcomment" ] && exit 0 [ -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'" ${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then

View File

@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # 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" dbname="$2"
shift;; shift;;
-d*) -d*)
dbname=`echo $1 | sed 's/^-d//'` dbname=`echo "$1" | sed 's/^-d//'`
;; ;;
--dbname=*) --dbname=*)
dbname=`echo $1 | sed 's/^--dbname=//'` dbname=`echo "$1" | sed 's/^--dbname=//'`
;; ;;
# misc options # misc options
--pglib|-L) --pglib|-L)
PGLIB="$2" PGLIB="$2"
shift;; shift;;
-L*) -L*)
PGLIB=`echo $1 | sed 's/^-L//'` PGLIB=`echo "$1" | sed 's/^-L//'`
;; ;;
--pglib=*) --pglib=*)
PGLIB=`echo $1 | sed 's/^--pglib=//'` PGLIB=`echo "$1" | sed 's/^--pglib=//'`
;; ;;
-*) -*)

View File

@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # 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. # Note - this should NOT be setuid.
# #
@ -97,13 +97,13 @@ do
CanAddUser=f CanAddUser=f
;; ;;
--sysid|-i) --sysid|-i)
SysID=$2 SysID="$2"
shift;; shift;;
--sysid=*) --sysid=*)
SysID=`echo $1 | sed 's/^--sysid=//'` SysID=`echo "$1" | sed 's/^--sysid=//'`
;; ;;
-i*) -i*)
SysID=`echo $1 | sed 's/^-i//'` SysID=`echo "$1" | sed 's/^-i//'`
;; ;;
--pwprompt|--pw|-P) --pwprompt|--pw|-P)
PwPrompt=t PwPrompt=t
@ -114,7 +114,7 @@ do
exit 1 exit 1
;; ;;
*) *)
NewUser=$1 NewUser="$1"
;; ;;
esac esac
shift; shift;
@ -182,14 +182,14 @@ if [ "$PwPrompt" ]; then
echo "Passwords didn't match." 1>&2 echo "Passwords didn't match." 1>&2
exit 1 exit 1
fi fi
Password=$FirstPw Password="$FirstPw"
fi fi
if [ -z "$CanCreateDb" ]; then if [ -z "$CanCreateDb" ]; then
$ECHO_N "Shall the new user be allowed to create databases? (y/n) "$ECHO_C $ECHO_N "Shall the new user be allowed to create databases? (y/n) "$ECHO_C
read REPLY read REPLY
[ $? -ne 0 ] && exit 1 [ $? -ne 0 ] && exit 1
if [ $REPLY = "y" -o $REPLY = "Y" ]; then if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
CanCreateDb=t CanCreateDb=t
else else
CanCreateDb=f 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 $ECHO_N "Shall the new user be allowed to create more new users? (y/n) "$ECHO_C
read REPLY read REPLY
[ $? -ne 0 ] && exit 1 [ $? -ne 0 ] && exit 1
if [ $REPLY = "y" -o $REPLY = "Y" ]; then if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
CanAddUser=t CanAddUser=t
else else
CanAddUser=f CanAddUser=f
@ -211,8 +211,8 @@ fi
# #
# build SQL command # build SQL command
# #
NewUser=`echo $NewUser | sed 's/\"/\\\"/g'` NewUser=`echo "$NewUser" | sed 's/\"/\\\"/g'`
Password=`echo $Password | sed 's/\"/\\\"/g'` Password=`echo "$Password" | sed 's/\"/\\\"/g'`
QUERY="CREATE USER \"$NewUser\"" QUERY="CREATE USER \"$NewUser\""

View File

@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # 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" dbname="$2"
shift;; shift;;
-d*) -d*)
dbname=`echo $1 | sed 's/^-d//'` dbname=`echo "$1" | sed 's/^-d//'`
;; ;;
--dbname=*) --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 echo "$CMDNAME: external error" 1>&2
exit 1 exit 1
fi 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 "$CMDNAME: There are $res functions/trigger procedures declared in language" 1>&2
echo "$lancomp. Language not removed." 1>&2 echo "$lancomp. Language not removed." 1>&2
exit 1 exit 1

View File

@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # 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. # Note - this should NOT be setuid.
# #
@ -134,7 +134,7 @@ if [ "$forcedel" = f ]; then
fi fi
DelUser=`echo $DelUser | sed 's/\"/\\\"/g'` DelUser=`echo "$DelUser" | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\"" ${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""