Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group