scripts.
Justin Clift
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.137 2001/09/08 15:24:00 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.138 2001/09/30 22:17:50 momjian Exp $
#
#-------------------------------------------------------------------------
if [ "$?" -ne 0 ]; then
exit_nicely
fi
- if [ ! -f $PGDATA/global/pg_pwd ]; then
+ if [ ! -f "$PGDATA"/global/pg_pwd ]; then
echo
echo "The password file wasn't generated. Please report this problem." 1>&2
exit_nicely
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.11 2001/02/18 18:33:59 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.12 2001/09/30 22:17:50 momjian Exp $
#
#-------------------------------------------------------------------------
# umask must disallow access to group, other for files and dirs
umask 077
-if [ ! -d $PGALTDATA ]; then
+if [ ! -d "$PGALTDATA" ]; then
echo "Creating directory $PGALTDATA"
mkdir "$PGALTDATA"
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
echo "$CMDNAME: could not create $PGALTDATA" 1>&2
echo "Make sure $PGALTDATA is a valid path and that you have permission to access it." 1>&2
exit_nicely
fi
-if [ ! -d $PGALTDATA/base ]; then
+if [ ! -d "$PGALTDATA"/base ]; then
echo "Creating directory $PGALTDATA/base"
mkdir "$PGALTDATA/base"
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
echo "$CMDNAME: could not create $PGALTDATA/base" 1>&2
echo "Make sure $PGALTDATA/base is a valid path and that you have permission to access it." 1>&2
exit_nicely
#!/bin/sh
#
-# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.11 2001/05/24 15:53:33 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.12 2001/09/30 22:17:50 momjian Exp $
#
CMDNAME=`basename $0`
# (This check is conceptually phony, but it's
# useful anyway in practice.)
ps hj $ipcs_cpid $ipcs_lpid >/dev/null 2>&1
- if [ $? -eq 0 ]; then
+ if [ "$?" -eq 0 ]; then
echo "skipped; process still exists (pid $ipcs_cpid or $ipcs_lpid)."
continue
fi
# try remove
ipcrm shm $ipcs_shmid
- if [ $? -eq 0 ]; then
+ if [ "$?" -eq 0 ]; then
did_anything=t
else
exit
echo -n "Semaphore $val ... "
# try remove
ipcrm sem $val
- if [ $? -eq 0 ]; then
+ if [ "$?" -eq 0 ]; then
did_anything=t
else
exit
# Author: Peter Eisentraut
# Public domain
-# $Header: /cvsroot/pgsql/src/bin/pg_config/Attic/pg_config.sh,v 1.5 2001/09/16 16:11:11 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_config/Attic/pg_config.sh,v 1.6 2001/09/30 22:17:51 momjian Exp $
me=`basename $0`
advice="\
Try '$me --help' for more information."
-if test $# -eq 0 ; then
+if test "$#" -eq 0 ; then
echo "$me: argument required" 1>&2
echo "$advice" 1>&2
exit 1
for opt
do
- case $opt in
+ case "$opt" in
--bindir) show="$show \$val_bindir";;
--includedir) show="$show \$val_includedir";;
--includedir-server)
# and "pg_group" tables, which belong to the whole installation rather
# than any one individual database.
#
-# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.12 2001/05/17 21:12:49 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.13 2001/09/30 22:17:51 momjian Exp $
CMDNAME=`basename $0`
globals_only=
-while [ $# -gt 0 ] ; do
+while [ "$#" -gt 0 ] ; do
case $1 in
--help)
usage=t
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.17 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.18 2001/09/30 22:17:51 momjian Exp $
#
#-------------------------------------------------------------------------
dbcomment=
dbpath=
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
else
dbname=`${PATHNAME}pg_id -u -n`
fi
- [ $? -ne 0 ] && exit 1
+ [ "$?" -ne 0 ] && exit 1
fi
[ "$withstring" ] && withstring=" WITH$withstring"
${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: database creation failed" 1>&2
exit 1
fi
dbcomment=`echo "$dbcomment" | sed "s/'/\\\\\'/g"`
${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: comment creation failed (database was created)" 1>&2
exit 1
fi
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.30 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.31 2001/09/30 22:17:51 momjian Exp $
#
#-------------------------------------------------------------------------
# ----------
# Get options, language name and dbname
# ----------
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.21 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.22 2001/09/30 22:17:51 momjian Exp $
#
# Note - this should NOT be setuid.
#
fi
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
if [ -z "$NewUser" ]; then
$ECHO_N "Enter name of user to add: "$ECHO_C
read NewUser
- [ $? -ne 0 ] && exit 1
+ [ "$?" -ne 0 ] && exit 1
fi
if [ "$PwPrompt" ]; then
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
+ [ "$?" -ne 0 ] && exit 1
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
CanCreateDb=t
else
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
+ [ "$?" -ne 0 ] && exit 1
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
CanAddUser=t
else
[ "$CanAddUser" = f ] && QUERY="$QUERY NOCREATEUSER"
${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: creation of user \"$NewUser\" failed" 1>&2
exit 1
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.12 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.13 2001/09/30 22:17:51 momjian Exp $
#
#-------------------------------------------------------------------------
fi
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
- [ $? -eq 1 ] && exit 1
+ [ "$?" -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
dbname=`echo $dbname | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: database removal failed" 1>&2
exit 1
fi
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.17 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.18 2001/09/30 22:17:51 momjian Exp $
#
#-------------------------------------------------------------------------
# ----------
# Get options, language name and dbname
# ----------
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
echo "$sqlcmd"
fi
lanplcallfoid=`$PSQL "$sqlcmd"`
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
if [ "$res" -ne 0 ]; then
echo "$CMDNAME: There are $res functions/trigger procedures declared in language" 1>&2
- echo "$langname. Language not removed." 1>&2
+ echo "$langname. Language not removed." 1>&2
exit 1
fi
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
handler=`$PSQL "$sqlcmd"`
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.13 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.14 2001/09/30 22:17:51 momjian Exp $
#
# Note - this should NOT be setuid.
#
fi
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
if [ -z "$DelUser" ]; then
$ECHO_N "Enter name of user to delete: "$ECHO_C
read DelUser
- [ $? -ne 0 ] && exit 1
+ [ "$?" -ne 0 ] && exit 1
fi
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
- [ $? -eq 1 ] && exit 1
+ [ "$?" -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
-if [ $? -ne 0 ]; then
+if [ "$?" -ne 0 ]; then
echo "$CMDNAME: deletion of user \"$DelUser\" failed" 1>&2
exit 1
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.18 2001/09/22 04:28:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.19 2001/09/30 22:17:51 momjian Exp $
#
#-------------------------------------------------------------------------
alldb=
quiet=0
-while [ $# -gt 0 ]
+while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
do
[ "$alldb" -a "$quiet" -ne 1 ] && echo "Vacuuming $db"
${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $full $verbose $analyze $table" -d $db
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
echo "$CMDNAME: vacuum $table $db failed" 1>&2
exit 1
fi