Put quotes around environment variables.
This commit is contained in:
parent
11d9d2cfaa
commit
d7d51bc138
@ -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
|
||||
|
@ -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=//'`
|
||||
;;
|
||||
|
||||
-*)
|
||||
|
@ -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\""
|
||||
|
||||
|
@ -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
|
||||
|
@ -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\""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user