Re: More problem with scripts - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: More problem with scripts
Date
Msg-id 200201031919.g03JJCu26848@candle.pha.pa.us
Whole thread Raw
In response to Re: More problem with scripts  (Brent Verner <brent@rcfile.org>)
Responses Re: More problem with scripts  (Brent Verner <brent@rcfile.org>)
List 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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Pavlo Baron"
Date:
Subject: Re: Smb to get involved
Next
From: Brent Verner
Date:
Subject: Re: More problem with scripts