#
#
# 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 $
#
#-------------------------------------------------------------------------
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
if [ -z "$dbname" ]; then
if [ "$PGUSER" ]; then
- dbname=$PGUSER
+ dbname="$PGUSER"
else
dbname=`${PATHNAME}pg_id -u -n`
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'"
# 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
#
#
# 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 $
#
#-------------------------------------------------------------------------
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=//'`
;;
-*)
#
#
# 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.
#
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
exit 1
;;
*)
- NewUser=$1
+ NewUser="$1"
;;
esac
shift;
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
$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
#
# 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\""
#
#
# 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 $
#
#-------------------------------------------------------------------------
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=//'`
;;
-*)
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
#
#
# 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.
#
fi
-DelUser=`echo $DelUser | sed 's/\"/\\\"/g'`
+DelUser=`echo "$DelUser" | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""