⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 destroydb.sh

📁 关系型数据库 Postgresql 6.5.2
💻 SH
字号:
#!/bin/sh#-------------------------------------------------------------------------## destroydb.sh--#    destroy a postgres database##    this program runs the monitor with the ? option to destroy#    the requested database.## Copyright (c) 1994, Regents of the University of California### IDENTIFICATION#    $Header: /usr/local/cvsroot/pgsql/src/bin/destroydb/destroydb.sh,v 1.8 1997/06/02 02:53:00 scrappy Exp $##-------------------------------------------------------------------------CMDNAME=`basename $0`if [ -z "$USER" ]; then    if [ -z "$LOGNAME" ]; then	if [ -z "`whoami`" ]; then	    echo "$CMDNAME: cannot determine user name"	    exit 1	fi    else	USER=$LOGNAME	export USER    fifidbname=$USERforcedel=twhile [ -n "$1" ]do	case $1 in 	        -i) forcedel=f;;		-a) AUTHSYS=$2; shift;;		-h) PGHOST=$2; shift;;		-p) PGPORT=$2; shift;;		 *) dbname=$1;;	esac	shift;doneif [ -z "$AUTHSYS" ]; then  AUTHOPT=""else  AUTHOPT="-a $AUTHSYS"fiif [ -z "$PGHOST" ]; then  PGHOSTOPT=""else  PGHOSTOPT="-h $PGHOST"fiif [ -z "$PGPORT" ]; then  PGPORTOPT=""else  PGPORTOPT="-p $PGPORT"fianswer=yif [ "$forcedel" = f ]   then   answer=f   while [ "$answer" != y -a "$answer" != n ]   do       echo "Database '$dbname' will be permanently deleted."       echo -n "Are you sure? (y/n) "       read answer   donefiif [ "$answer" = y ]then  psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "drop database $dbname" template1    if [ $? -ne 0 ]       then echo "$CMDNAME: database destroy failed on $dbname."       exit 1    fifiexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -