From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] clarify description of 'exec' and 'return'
Date: Thu, 30 Apr 2015 23:20:14 +0900 [thread overview]
Message-ID: <137DC33A-2FE7-484C-B382-C47D3E7AB950@kba.biglobe.ne.jp> (raw)
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.
--
1.9.5 (Apple Git-50.3)
reply other threads:[~2015-04-30 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=137DC33A-2FE7-484C-B382-C47D3E7AB950@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).