Thread: More fixes for missing double quotes in the shell scripts

More fixes for missing double quotes in the shell scripts

From
Justin Clift
Date:
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

Re: More fixes for missing double quotes in the shell scripts

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> 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

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: More fixes for missing double quotes in the shell scripts

From
Tom Lane
Date:
Surely it's not necessary to put double quotes around $? ...
that can only have an integral value, no?

            regards, tom lane

Re: More fixes for missing double quotes in the shell scripts

From
Justin
Date:
Hi Tom,

I agree it's not strictly necessary, but I thought I'd add them in to
follow the generic "good programming practise" of always quoting
variables in shell script tests.

As far as I'm aware it doesn't break compatility on any system, and it
makes for greater "consistency".

If there's really something fundamentally wrong with this idea, then
let's only do the necessary ones.

:)

+ Justin


Tom Lane wrote:
>
> Surely it's not necessary to put double quotes around $? ...
> that can only have an integral value, no?
>
>                         regards, tom lane



Re: More fixes for missing double quotes in the shell scripts

From
Tom Lane
Date:
Justin <justin@postgresql.org> writes:
> If there's really something fundamentally wrong with this idea, then
> let's only do the necessary ones.

No, nothing fundamentally wrong.  I just prefer to avoid unnecessary
notational clutter.  Your approach of "let's quote *every* shell
variable" is defensible but I find it a tad over-the-top.  Comes down
to a judgment call about code legibility, I suppose.

            regards, tom lane

Re: More fixes for missing double quotes in the shell scripts

From
Justin
Date:
Heh Heh Heh

It's cool with me.

I'll resubmit patches tonight which don't go "over the top" in this way
then.

:)

Regards and best wishes,

Justin Clift


Tom Lane wrote:
>
> Justin <justin@postgresql.org> writes:
> > If there's really something fundamentally wrong with this idea, then
> > let's only do the necessary ones.
>
> No, nothing fundamentally wrong.  I just prefer to avoid unnecessary
> notational clutter.  Your approach of "let's quote *every* shell
> variable" is defensible but I find it a tad over-the-top.  Comes down
> to a judgment call about code legibility, I suppose.
>
>                         regards, tom lane

Re: More fixes for missing double quotes in the shell scripts

From
Bruce Momjian
Date:
> Justin <justin@postgresql.org> writes:
> > If there's really something fundamentally wrong with this idea, then
> > let's only do the necessary ones.
>
> No, nothing fundamentally wrong.  I just prefer to avoid unnecessary
> notational clutter.  Your approach of "let's quote *every* shell
> variable" is defensible but I find it a tad over-the-top.  Comes down
> to a judgment call about code legibility, I suppose.

I prefer the quoting all style, though $? is a special case, as is $#,
and $$, which I certainly would not quote.  Up to you guys.  Also, I
like that fact we are cleaning this up.  From my days writing shql, I
always thought quoting behavour should have been the default for
environment variables.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: More fixes for missing double quotes in the shell

From
Peter Eisentraut
Date:
Justin writes:

> I agree it's not strictly necessary, but I thought I'd add them in to
> follow the generic "good programming practise" of always quoting
> variables in shell script tests.

In my purely personal opinion it's better to be aware of the possible
values of a variable than to blindly quote everything.  Somewhere you're
going to run into nested quote situations which cannot be done portably,
at which point you have to start doing that anyway.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: More fixes for missing double quotes in the shell

From
Bruce Momjian
Date:
> Justin writes:
>
> > I agree it's not strictly necessary, but I thought I'd add them in to
> > follow the generic "good programming practise" of always quoting
> > variables in shell script tests.
>
> In my purely personal opinion it's better to be aware of the possible
> values of a variable than to blindly quote everything.  Somewhere you're
> going to run into nested quote situations which cannot be done portably,
> at which point you have to start doing that anyway.

I am not good at remembering what could be in a variabe.  I find it
easier to just quote everything.  If I have embedded quotes, I do
"\"$X\"".  That requires fiddling less often than having values that
need/don't need quote protection.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: More fixes for missing double quotes in the shell scripts

From
Bruce Momjian
Date:
Patch applied.  Thanks.

> 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

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026