More fixes for missing double quotes in the shell scripts - Mailing list pgsql-patches
| From | Justin Clift |
|---|---|
| Subject | More fixes for missing double quotes in the shell scripts |
| Date | |
| Msg-id | [email protected] Whole thread Raw |
| Responses |
Re: More fixes for missing double quotes in the shell scripts
Re: More fixes for missing double quotes in the shell scripts Re: More fixes for missing double quotes in the shell scripts |
| List | pgsql-patches |
Hi Bruce,
These are further fixes for double quotes missing in the various shell
scripts.
:-)
Regards and best wishes,
Justin Clift
--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi*** src/bin/initdb/initdb.sh.old Sun Sep 23 14:52:08 2001
--- src/bin/initdb/initdb.sh Sun Sep 23 14:58:38 2001
***************
*** 539,545 ****
if [ "$?" -ne 0 ]; then
exit_nicely
fi
! if [ ! -f $PGDATA/global/pg_pwd ]; then
echo
echo "The password file wasn't generated. Please report this problem." 1>&2
exit_nicely
--- 539,545 ----
if [ "$?" -ne 0 ]; then
exit_nicely
fi
! if [ ! -f "$PGDATA"/global/pg_pwd ]; then
echo
echo "The password file wasn't generated. Please report this problem." 1>&2
exit_nicely
*** src/bin/initlocation/initlocation.sh.old Sun Sep 23 15:02:13 2001
--- src/bin/initlocation/initlocation.sh Sun Sep 23 15:04:23 2001
***************
*** 125,134 ****
# umask must disallow access to group, other for files and dirs
umask 077
! if [ ! -d $PGALTDATA ]; then
echo "Creating directory $PGALTDATA"
mkdir "$PGALTDATA"
! 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
--- 125,134 ----
# umask must disallow access to group, other for files and dirs
umask 077
! if [ ! -d "$PGALTDATA" ]; then
echo "Creating directory $PGALTDATA"
mkdir "$PGALTDATA"
! 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
***************
*** 139,148 ****
fi
! if [ ! -d $PGALTDATA/base ]; then
echo "Creating directory $PGALTDATA/base"
mkdir "$PGALTDATA/base"
! 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
--- 139,148 ----
fi
! if [ ! -d "$PGALTDATA"/base ]; then
echo "Creating directory $PGALTDATA/base"
mkdir "$PGALTDATA/base"
! 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
*** src/bin/ipcclean/ipcclean.sh.old Sun Sep 23 15:05:55 2001
--- src/bin/ipcclean/ipcclean.sh Sun Sep 23 15:13:48 2001
***************
*** 74,87 ****
# (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
echo "skipped; process still exists (pid $ipcs_cpid or $ipcs_lpid)."
continue
fi
# try remove
ipcrm shm $ipcs_shmid
! if [ $? -eq 0 ]; then
did_anything=t
else
exit
--- 74,87 ----
# (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
echo "skipped; process still exists (pid $ipcs_cpid or $ipcs_lpid)."
continue
fi
# try remove
ipcrm shm $ipcs_shmid
! if [ "$?" -eq 0 ]; then
did_anything=t
else
exit
***************
*** 93,99 ****
echo -n "Semaphore $val ... "
# try remove
ipcrm sem $val
! if [ $? -eq 0 ]; then
did_anything=t
else
exit
--- 93,99 ----
echo -n "Semaphore $val ... "
# try remove
ipcrm sem $val
! if [ "$?" -eq 0 ]; then
did_anything=t
else
exit
*** src/bin/scripts/createdb.old Sun Sep 23 15:28:00 2001
--- src/bin/scripts/createdb Sun Sep 23 15:29:45 2001
***************
*** 26,32 ****
dbcomment=
dbpath=
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 26,32 ----
dbcomment=
dbpath=
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 154,160 ****
else
dbname=`${PATHNAME}pg_id -u -n`
fi
! [ $? -ne 0 ] && exit 1
fi
--- 154,160 ----
else
dbname=`${PATHNAME}pg_id -u -n`
fi
! [ "$?" -ne 0 ] && exit 1
fi
***************
*** 170,176 ****
[ "$withstring" ] && withstring=" WITH$withstring"
${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: database creation failed" 1>&2
exit 1
fi
--- 170,176 ----
[ "$withstring" ] && withstring=" WITH$withstring"
${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: database creation failed" 1>&2
exit 1
fi
***************
*** 181,187 ****
dbcomment=`echo "$dbcomment" | sed "s/'/\\\\\'/g"`
${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: comment creation failed (database was created)" 1>&2
exit 1
fi
--- 181,187 ----
dbcomment=`echo "$dbcomment" | sed "s/'/\\\\\'/g"`
${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: comment creation failed (database was created)" 1>&2
exit 1
fi
*** src/bin/scripts/createlang.sh.old Sun Sep 23 15:25:05 2001
--- src/bin/scripts/createlang.sh Sun Sep 23 15:27:40 2001
***************
*** 37,43 ****
# ----------
# Get options, language name and dbname
# ----------
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 37,43 ----
# ----------
# Get options, language name and dbname
# ----------
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 237,243 ****
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
--- 237,243 ----
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
***************
*** 270,276 ****
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
--- 270,276 ----
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
***************
*** 281,287 ****
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
--- 281,287 ----
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
*** src/bin/scripts/createuser.old Sun Sep 23 15:30:00 2001
--- src/bin/scripts/createuser Sun Sep 23 15:33:16 2001
***************
*** 39,45 ****
fi
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 39,45 ----
fi
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 174,180 ****
if [ -z "$NewUser" ]; then
$ECHO_N "Enter name of user to add: "$ECHO_C
read NewUser
! [ $? -ne 0 ] && exit 1
fi
if [ "$PwPrompt" ]; then
--- 174,180 ----
if [ -z "$NewUser" ]; then
$ECHO_N "Enter name of user to add: "$ECHO_C
read NewUser
! [ "$?" -ne 0 ] && exit 1
fi
if [ "$PwPrompt" ]; then
***************
*** 198,204 ****
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
CanCreateDb=t
else
--- 198,204 ----
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
CanCreateDb=t
else
***************
*** 209,215 ****
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
CanAddUser=t
else
--- 209,215 ----
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
CanAddUser=t
else
***************
*** 239,245 ****
[ "$CanAddUser" = f ] && QUERY="$QUERY NOCREATEUSER"
${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
! if [ $? -ne 0 ]; then
echo "$CMDNAME: creation of user \"$NewUser\" failed" 1>&2
exit 1
fi
--- 239,245 ----
[ "$CanAddUser" = f ] && QUERY="$QUERY NOCREATEUSER"
${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: creation of user \"$NewUser\" failed" 1>&2
exit 1
fi
*** src/bin/scripts/dropdb.old Sun Sep 23 15:33:29 2001
--- src/bin/scripts/dropdb Sun Sep 23 15:36:57 2001
***************
*** 34,40 ****
fi
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 34,40 ----
fi
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 126,132 ****
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
! [ $? -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
--- 126,132 ----
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
! [ "$?" -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
***************
*** 134,140 ****
dbname=`echo $dbname | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
! if [ $? -ne 0 ]; then
echo "$CMDNAME: database removal failed" 1>&2
exit 1
fi
--- 134,140 ----
dbname=`echo $dbname | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: database removal failed" 1>&2
exit 1
fi
*** src/bin/scripts/droplang.old Sun Sep 23 15:37:12 2001
--- src/bin/scripts/droplang Sun Sep 23 15:39:59 2001
***************
*** 36,42 ****
# ----------
# Get options, language name and dbname
# ----------
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 36,42 ----
# ----------
# Get options, language name and dbname
# ----------
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 168,174 ****
echo "$sqlcmd"
fi
lanplcallfoid=`$PSQL "$sqlcmd"`
! if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
--- 168,174 ----
echo "$sqlcmd"
fi
lanplcallfoid=`$PSQL "$sqlcmd"`
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
***************
*** 186,198 ****
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! 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
exit 1
fi
--- 186,198 ----
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! 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
exit 1
fi
***************
*** 204,210 ****
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
--- 204,210 ----
echo "$sqlcmd"
fi
res=`$PSQL "$sqlcmd"`
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
***************
*** 222,228 ****
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
--- 222,228 ----
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
***************
*** 239,245 ****
echo "$sqlcmd"
fi
handler=`$PSQL "$sqlcmd"`
! if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
--- 239,245 ----
echo "$sqlcmd"
fi
handler=`$PSQL "$sqlcmd"`
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
fi
***************
*** 249,255 ****
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ $? -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
--- 249,255 ----
echo "$sqlcmd"
fi
$PSQL "$sqlcmd"
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
*** src/bin/scripts/dropuser.old Sun Sep 23 15:40:15 2001
--- src/bin/scripts/dropuser Sun Sep 23 15:42:21 2001
***************
*** 34,40 ****
fi
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 34,40 ----
fi
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 121,127 ****
if [ -z "$DelUser" ]; then
$ECHO_N "Enter name of user to delete: "$ECHO_C
read DelUser
! [ $? -ne 0 ] && exit 1
fi
--- 121,127 ----
if [ -z "$DelUser" ]; then
$ECHO_N "Enter name of user to delete: "$ECHO_C
read DelUser
! [ "$?" -ne 0 ] && exit 1
fi
***************
*** 130,136 ****
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
! [ $? -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
--- 130,136 ----
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
! [ "$?" -eq 1 ] && exit 1
[ "$REPLY" != "y" -a "$REPLY" != "Y" ] && exit 0
fi
***************
*** 139,145 ****
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
! if [ $? -ne 0 ]; then
echo "$CMDNAME: deletion of user \"$DelUser\" failed" 1>&2
exit 1
fi
--- 139,145 ----
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
! if [ "$?" -ne 0 ]; then
echo "$CMDNAME: deletion of user \"$DelUser\" failed" 1>&2
exit 1
fi
*** src/bin/pg_config/pg_config.sh.old Sun Sep 23 15:15:20 2001
--- src/bin/pg_config/pg_config.sh Sun Sep 23 15:16:40 2001
***************
*** 41,47 ****
advice="\
Try '$me --help' for more information."
! if test $# -eq 0 ; then
echo "$me: argument required" 1>&2
echo "$advice" 1>&2
exit 1
--- 41,47 ----
advice="\
Try '$me --help' for more information."
! if test "$#" -eq 0 ; then
echo "$me: argument required" 1>&2
echo "$advice" 1>&2
exit 1
***************
*** 51,57 ****
for opt
do
! case $opt in
--bindir) show="$show \$val_bindir";;
--includedir) show="$show \$val_includedir";;
--includedir-server)
--- 51,57 ----
for opt
do
! case "$opt" in
--bindir) show="$show \$val_bindir";;
--includedir) show="$show \$val_includedir";;
--includedir-server)
*** src/bin/pg_dump/pg_dumpall.sh.old Sun Sep 23 15:17:51 2001
--- src/bin/pg_dump/pg_dumpall.sh Sun Sep 23 15:22:49 2001
***************
*** 77,83 ****
globals_only=
! while [ $# -gt 0 ] ; do
case $1 in
--help)
usage=t
--- 77,83 ----
globals_only=
! while [ "$#" -gt 0 ] ; do
case $1 in
--help)
usage=t
*** src/bin/scripts/vacuumdb.old Sun Sep 23 15:42:40 2001
--- src/bin/scripts/vacuumdb Sun Sep 23 15:48:03 2001
***************
*** 28,34 ****
alldb=
quiet=0
! while [ $# -gt 0 ]
do
case "$1" in
--help|-\?)
--- 28,34 ----
alldb=
quiet=0
! while [ "$#" -gt 0 ]
do
case "$1" in
--help|-\?)
***************
*** 160,166 ****
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
echo "$CMDNAME: vacuum $table $db failed" 1>&2
exit 1
fi
--- 160,166 ----
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
echo "$CMDNAME: vacuum $table $db failed" 1>&2
exit 1
fi
pgsql-patches by date: