From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10808 invoked by alias); 30 Apr 2015 14:54:39 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35008 Received: (qmail 18484 invoked from network); 30 Apr 2015 14:54:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] clarify description of 'exec' and 'return' Message-Id: <137DC33A-2FE7-484C-B382-C47D3E7AB950@kba.biglobe.ne.jp> Date: Thu, 30 Apr 2015 23:20:14 +0900 To: zsh-workers@zsh.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Biglobe-Spnum: 64171 Two simple clarifications in builtins.yo: return (and its relatives) can take an arithmetic expression. 'exec > file' takes effect in the current shell. (The latter is 'well known' but seems to be not documented anywhere) --- Doc/Zsh/builtins.yo | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 985d19e..c4acf76 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -198,7 +198,7 @@ cindex(exiting loops) cindex(loops, exiting) item(tt(break) [ var(n) ])( Exit from an enclosing tt(for), tt(while), -tt(until), tt(select) or tt(repeat) loop. If var(n) +tt(until), tt(select) or tt(repeat) loop. If an arithmetic expression = var(n) is specified, then break var(n) levels instead of just one. ) findex(builtin) @@ -291,7 +291,7 @@ cindex(continuing loops) item(tt(continue) [ var(n) ])( Resume the next iteration of the enclosing tt(for), tt(while), tt(until), tt(select) or -tt(repeat) loop. If var(n) is specified, break out of +tt(repeat) loop. If an arithmetic expression var(n) is specified, break = out of var(n)-1 loops and resume at the var(n)th enclosing loop. ) alias(declare)(typeset) @@ -615,16 +615,21 @@ the same as if the commands had been executed = directly by the shell; 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(simple command))( -Replace the current shell with an external command rather than forking. +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. 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 executed. See noderef(Precommand Modifiers). + +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. ) findex(exit) item(tt(exit) [ var(n) ])( -Exit the shell with the exit status specified by var(n); if none +Exit the shell with the exit status specified by an arithmetic +expression var(n); if none is specified, use the exit status from the last command executed. pindex(IGNORE_EOF, use of) An EOF condition will also cause the shell to exit, unless @@ -1409,7 +1414,8 @@ findex(return) cindex(functions, returning from) item(tt(return) [ var(n) ])( Causes a shell function or `tt(.)' script to return to -the invoking script with the return status specified by var(n). If = var(n) +the invoking script with the return status specified by +an arithmetic expression var(n). If var(n) is omitted, the return status is that of the last command executed. =20 --=20 1.9.5 (Apple Git-50.3)