Re: More problem with scripts

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: More problem with scripts
Date: 2002-01-03 19:19:12
Message-ID: 200201031919.g03JJCu26848@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Actually, we can just do:

> *)
> dbname=$1
> [ "$#" -ne 1 ] && usage=1

Meaning if they have anything after the dbname, it is an error. This
catches flags _after_ the dbname. Seems most of the script have this
problem. If people want it fixed, I can easily do it; just give me to
go-ahead.

---------------------------------------------------------------------------

Brent Verner wrote:
> [2002-01-03 13:12] Bruce Momjian said:
> | Look at this:
> |
> | $ dropdb lijasdf oiuwqe test
> | DROP DATABASE
> |
> | The create/drop scripts only process the last arguments, ignoring
> | earlier ones. I assume no one wants me to fix it now so I will add this
> | to TODO:
>
> something /simple/ might look like.
>
> Index: dropdb
> ===================================================================
> RCS file: /var/cvsup/pgsql/src/bin/scripts/dropdb,v
> retrieving revision 1.13
> diff -c -r1.13 dropdb
> *** dropdb 30 Sep 2001 22:17:51 -0000 1.13
> --- dropdb 3 Jan 2002 18:54:17 -0000
> ***************
> *** 88,94 ****
> exit 1
> ;;
> *)
> ! dbname="$1"
> ;;
> esac
> shift
> --- 88,95 ----
> exit 1
> ;;
> *)
> ! [ ! -z "$dbname" ] && usage=1
> ! dbname=$1
> ;;
> esac
> shift
> ***************
> *** 132,137 ****
> --- 133,141 ----
>
>
> dbname=`echo $dbname | sed 's/\"/\\\"/g'`
> +
> + echo $dbname
> + exit 0;
>
> ${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
> if [ "$?" -ne 0 ]; then
>
> --
> "Develop your talent, man, and leave the world something. Records are
> really gifts from people. To think that an artist would love you enough
> to share his music with anyone is a beautiful thing." -- Duane Allman
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-01-03 19:37:17 Re: LWLock contention: I think I understand the problem
Previous Message Brent Verner 2002-01-03 19:16:24 Re: More problem with scripts