mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-10 22:31:24 +02:00
15264: improved doc for variant complex commands
This commit is contained in:
parent
f074d050d8
commit
c19aa5da61
2 changed files with 23 additions and 10 deletions
|
@ -1,5 +1,9 @@
|
|||
2001-07-05 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 15264: Doc/Zsh/grammar.yo: improve description of use of
|
||||
variant complex command forms to avoid confusing the present
|
||||
writer.
|
||||
|
||||
* 15261: Test/E01options.ztst, Test/ztst.zsh: remaining easy
|
||||
option tests.
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ For example,
|
|||
|
||||
example(dmesg | grep panic && print yes)
|
||||
|
||||
is a sublist consisting of two piplines, the second just a simple command
|
||||
is a sublist consisting of two pipelines, the second just a simple command
|
||||
which will be executed if and only if the tt(grep) command returns a zero
|
||||
value. If it does not, the value of the sublist is that return value, else
|
||||
it is the value returned by the tt(print) (almost certainly zero).
|
||||
|
@ -203,6 +203,7 @@ cindex(user selection)
|
|||
cindex(selection, user)
|
||||
item(tt(select) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))(
|
||||
where var(term) is one or more newline or tt(;) to terminate the var(word)s.
|
||||
vindex(REPLY, use of)
|
||||
Print the set of var(word)s, each preceded by a number.
|
||||
If the tt(in) var(word) is omitted, use the positional parameters.
|
||||
The tt(PROMPT3) prompt is printed and a line is read from the line editor
|
||||
|
@ -262,11 +263,16 @@ cindex(commands, alternate forms for complex)
|
|||
Many of zsh's complex commands have alternate forms. These particular
|
||||
versions of complex commands should be considered deprecated and may be
|
||||
removed in the future. The versions in the previous section should be
|
||||
preferred instead. The short versions below only work if var(sublist)
|
||||
is of the form `tt({) var(list) tt(})' or if the tt(SHORT_LOOPS)
|
||||
option is set. In this case, the test part of the loop must also be
|
||||
suitably delimited, such as by `tt([[ ... ]])' or `tt((( ... )))', else
|
||||
the end of the test will not be recognized.
|
||||
preferred instead.
|
||||
|
||||
The short versions below only work if var(sublist) is of the form `tt({)
|
||||
var(list) tt(})' or if the tt(SHORT_LOOPS) option is set. For the tt(if),
|
||||
tt(while) and tt(until) commands, in both these cases the test part of the
|
||||
loop must also be suitably delimited, such as by `tt([[ ... ]])' or `tt(((
|
||||
... )))', else the end of the test will not be recognized. For the
|
||||
tt(for), tt(repeat), tt(case) and tt(select) commands no such special form
|
||||
for the arguments is necessary, but the other condition (the special form
|
||||
of var(sublist) or use of the tt(SHORT_LOOPS) option) still applies.
|
||||
|
||||
startitem()
|
||||
item(tt(if) var(list) tt({) var(list) tt(}) [ tt(elif) var(list) tt({) var(list) tt(}) ] ... [ tt(else {) var(list) tt(}) ])(
|
||||
|
@ -286,7 +292,8 @@ example(if true { # Does not work!
|
|||
does em(not), since the test is not suitably delimited.
|
||||
)
|
||||
item(tt(if) var(list) var(sublist))(
|
||||
A short form of the alternate `if'.
|
||||
A short form of the alternate `if'. The same limitations on the form of
|
||||
var(list) apply as for the previous form.
|
||||
)
|
||||
item(tt(for) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(sublist))(
|
||||
A short form of tt(for).
|
||||
|
@ -302,10 +309,12 @@ item(tt(foreach) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(list) tt(end)
|
|||
Another form of tt(for).
|
||||
)
|
||||
item(tt(while) var(list) tt({) var(list) tt(}))(
|
||||
An alternative form of tt(while).
|
||||
An alternative form of tt(while). Note the limitations on the form of
|
||||
var(list) mentioned above.
|
||||
)
|
||||
item(tt(until) var(list) tt({) var(list) tt(}))(
|
||||
An alternative form of tt(until).
|
||||
An alternative form of tt(until). Note the limitations on the form of
|
||||
var(list) mentioned above.
|
||||
)
|
||||
item(tt(repeat) var(word) var(sublist))(
|
||||
This is a short form of tt(repeat).
|
||||
|
@ -387,5 +396,5 @@ outputs nothing apart from a newline if tt(RC_QUOTES) is not set, but one
|
|||
single quote if it is set.
|
||||
|
||||
Inside double quotes (tt("")), parameter and
|
||||
command substitution occurs, and `tt(\)' quotes the characters
|
||||
command substitution occur, and `tt(\)' quotes the characters
|
||||
`tt(\)', `tt(`)', `tt(")', and `tt($)'.
|
||||
|
|
Loading…
Reference in a new issue