Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 May 2013 09:26:48 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r251055 - user/des/zfs-backup
Message-ID:  <201305280926.r4S9QmM5003699@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue May 28 09:26:48 2013
New Revision: 251055
URL: http://svnweb.freebsd.org/changeset/base/251055

Log:
  If stdin is not a tty, abort rather than prompt the user.

Modified:
  user/des/zfs-backup/zfs-backup.sh

Modified: user/des/zfs-backup/zfs-backup.sh
==============================================================================
--- user/des/zfs-backup/zfs-backup.sh	Tue May 28 09:25:58 2013	(r251054)
+++ user/des/zfs-backup/zfs-backup.sh	Tue May 28 09:26:48 2013	(r251055)
@@ -105,6 +105,7 @@ if [ -z "$last" ] ; then
 	info "It looks like this is the first backup from $fqsrc to $fqdst." \
 	    "Continuing will DESTROY the contents of $fqdst, including any" \
 	    "preexisting snapshots, and replace them with the contents of $fqsrc."
+	[ -t 0 ] || error "stdin is not a terminal - aborting"
 	while :; do
 		echo -n "Are you sure you want to proceed? (yes/no) "
 		read answer



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305280926.r4S9QmM5003699>