about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-03-30 16:20:03 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-03-30 16:20:03 +0000
commit30697061f2630543cccb9648e14b1fe7fa1d93ee (patch)
treefad7fb5d6f0cbf5eba64e691a5b74e61baef3ce9
parent44ff671fe5584a9fb073c4b767825c58504aa083 (diff)
downloadzsh-30697061f2630543cccb9648e14b1fe7fa1d93ee.tar.gz
zsh-30697061f2630543cccb9648e14b1fe7fa1d93ee.tar.xz
zsh-30697061f2630543cccb9648e14b1fe7fa1d93ee.zip
Refuse to setopt noexec when interactive
-rw-r--r--Doc/Zsh/options.yo2
-rw-r--r--Src/options.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index aec878774..025368d7c 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -374,6 +374,8 @@ cindex(command execution, enabling)
 item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)) <D>)(
 Do execute commands.  Without this option, commands are
 read and checked for syntax errors, but not executed.
+This option cannot be turned off in an interactive shell,
+except when `tt(-n)' is supplied to the shell at startup.
 )
 pindex(EXTENDED_GLOB)
 cindex(globbing, extended)
diff --git a/Src/options.c b/Src/options.c
index 7223b1d59..139926428 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -647,6 +647,9 @@ dosetopt(int optno, int value, int force)
 	    for (s = rparams; *s; s++)
 		restrictparam(*s);
 	}
+    } else if(!force && optno == EXECOPT && !value && interact) {
+	/* cannot set noexec when interactive */
+	return -1;
     } else if(!force && (optno == INTERACTIVE || optno == SHINSTDIN ||
 	    optno == SINGLECOMMAND)) {
 	if (opts[optno] == value)