mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] Another destroydb patch This is a patch to my previous destroydb patch cause some people wanted slightly different behavior. After this patch is applied, destroydb will destroy a database as usual, but if added -i flag (which could be aliased like rm -i) would ask for confirmation.
This commit is contained in:
parent
f9f98e3aff
commit
8445ccd57a
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.7 1997/06/01 15:40:08 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.8 1997/06/02 02:53:00 scrappy Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ if [ -z "$USER" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dbname=$USER
|
dbname=$USER
|
||||||
forcedel=f
|
forcedel=t
|
||||||
while [ -n "$1" ]
|
while [ -n "$1" ]
|
||||||
do
|
do
|
||||||
case $1 in
|
case $1 in
|
||||||
-y) forcedel=t;;
|
-i) forcedel=f;;
|
||||||
-a) AUTHSYS=$2; shift;;
|
-a) AUTHSYS=$2; shift;;
|
||||||
-h) PGHOST=$2; shift;;
|
-h) PGHOST=$2; shift;;
|
||||||
-p) PGPORT=$2; shift;;
|
-p) PGPORT=$2; shift;;
|
||||||
@ -67,6 +67,7 @@ if [ "$forcedel" = f ]
|
|||||||
|
|
||||||
while [ "$answer" != y -a "$answer" != n ]
|
while [ "$answer" != y -a "$answer" != n ]
|
||||||
do
|
do
|
||||||
|
echo "Database '$dbname' will be permanently deleted."
|
||||||
echo -n "Are you sure? (y/n) "
|
echo -n "Are you sure? (y/n) "
|
||||||
read answer
|
read answer
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user