From d4b94b5e8388c744a1d879fecb5af957b170c4c1 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 26 Jul 2017 16:56:23 +0100 Subject: 41464, 41466: With POSIX_BUILTINS, exec only executes sexternal commands. Document the default behaviour and add a test. --- Doc/Zsh/builtins.yo | 8 +++++++- Doc/Zsh/options.yo | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'Doc') diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 333db1c2c..99b1dd45b 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -667,7 +667,10 @@ if there are no var(args) or they contain no commands (i.e. are an empty string or whitespace) the return status is zero. ) item(tt(exec) [ tt(-cl) ] [ tt(-a) var(argv0) ] [ var(command) [ var(arg) ... ] ])( -Replace the current shell with an external var(command) rather than forking. +Replace the current shell with var(command) rather than forking. +If var(command) is a shell builtin command or a shell function, +the shell executes it, then immediately exits. + With tt(-c) clear the environment; with tt(-l) prepend tt(-) to the tt(argv[0]) string of the command executed (to simulate a login shell); with tt(-a) var(argv0) set the tt(argv[0]) string of the command @@ -675,6 +678,9 @@ executed. See ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ ifnzman(noderef(Precommand Modifiers)). +If the option tt(POSIX_BUILTINS) is set, var(command) is never +interpreted as a shell builtin command or shell function. + cindex(redirection, current shell's I/O) If var(command) is omitted but any redirections are specified, then the redirections will take effect in the current shell. diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index cc6ae2a47..70092d681 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -2140,6 +2140,10 @@ In addition, various error conditions associated with the above builtins or tt(exec) cause a non-interactive shell to exit and an interactive shell to return to its top-level processing. +Furthermore, functions and shell builtins are not executed after +an tt(exec) prefix; the command to be executed must be an external +command found in the path. + Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible fashion in that the associated variable tt(OPTIND) is not made local to functions. -- cgit 1.4.1