mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-10 12:40:58 +02:00
53709: docs: clarify glob-qualifier syntax
This commit is contained in:
parent
6600350d20
commit
a9bde1b8d1
3 changed files with 22 additions and 8 deletions
|
@ -1,5 +1,8 @@
|
||||||
2025-06-03 dana <dana@dana.is>
|
2025-06-03 dana <dana@dana.is>
|
||||||
|
|
||||||
|
* 53709: Doc/Zsh/expn.yo, Doc/Zsh/options.yo: clarify
|
||||||
|
glob-qualifier syntax
|
||||||
|
|
||||||
* github #136: Completion/Unix/Command/_col: complete col
|
* github #136: Completion/Unix/Command/_col: complete col
|
||||||
|
|
||||||
2025-05-31 Bart Schaefer <schaefer@zsh.org>
|
2025-05-31 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
|
@ -2800,8 +2800,8 @@ will be inserted in the argument list.
|
||||||
|
|
||||||
pindex(BARE_GLOB_QUAL, use of)
|
pindex(BARE_GLOB_QUAL, use of)
|
||||||
If the option tt(BARE_GLOB_QUAL) is set, then a trailing set of parentheses
|
If the option tt(BARE_GLOB_QUAL) is set, then a trailing set of parentheses
|
||||||
containing no `tt(|)' or `tt(LPAR())' characters (or `tt(~)' if it is special)
|
containing no unquoted `tt(|)' or `tt(LPAR())' characters (or `tt(~)' if
|
||||||
is taken as a set of
|
it is special due to tt(EXTENDED_GLOB)) is taken as a set of
|
||||||
glob qualifiers. A glob subexpression that would normally be taken as glob
|
glob qualifiers. A glob subexpression that would normally be taken as glob
|
||||||
qualifiers, for example `tt((^x))', can be forced to be treated as part of
|
qualifiers, for example `tt((^x))', can be forced to be treated as part of
|
||||||
the glob pattern by doubling the parentheses, in this case producing
|
the glob pattern by doubling the parentheses, in this case producing
|
||||||
|
@ -2828,6 +2828,10 @@ it is also valid if it is simply tt(LPAR()#q+RPAR()). This does
|
||||||
not apply to the right hand side of pattern match operators as the
|
not apply to the right hand side of pattern match operators as the
|
||||||
syntax already has special significance.
|
syntax already has special significance.
|
||||||
|
|
||||||
|
With either syntax, normal quoting and expansion rules apply to the list
|
||||||
|
of qualifiers, so that the forms `tt(*(.))', `tt(*(#q"."))', and
|
||||||
|
`tt(qual=.;) var(...) tt(*(#q$qual))' are generally equivalent.
|
||||||
|
|
||||||
A qualifier may be any one of the following:
|
A qualifier may be any one of the following:
|
||||||
|
|
||||||
startitem()
|
startitem()
|
||||||
|
@ -2945,16 +2949,23 @@ permission.
|
||||||
)
|
)
|
||||||
xitem(tt(e)var(string))
|
xitem(tt(e)var(string))
|
||||||
item(tt(PLUS())var(cmd))(
|
item(tt(PLUS())var(cmd))(
|
||||||
The var(string) will be executed as shell code. The filename will be
|
The var(string) or var(cmd) will be executed as shell code. The
|
||||||
|
filename will be
|
||||||
included in the list if and only if the code returns a zero status (usually
|
included in the list if and only if the code returns a zero status (usually
|
||||||
the status of the last command).
|
the status of the last command).
|
||||||
|
|
||||||
In the first form, the first character after the `tt(e)'
|
In the first form, the first character after the `tt(e)'
|
||||||
will be used as a separator and anything up to the next matching separator
|
will be used as a separator and anything up to the next matching separator
|
||||||
will be taken as the var(string); `tt([)', `tt({)', and `tt(<)' match
|
will be taken as the var(string); `tt(LPAR())', `tt([)', `tt({)', and
|
||||||
`tt(])', `tt(})', and `tt(>)', respectively, while any other character
|
`tt(<)' match `tt(RPAR())', `tt(])', `tt(})', and `tt(>)', respectively,
|
||||||
matches itself. Note that expansions must be quoted in the var(string)
|
while any other character matches itself.
|
||||||
to prevent them from being expanded before globbing is done.
|
As with glob qualifiers in general, normal quoting and expansion rules
|
||||||
|
apply to the entire var(string). Thus expansions must be quoted to
|
||||||
|
prevent them from being expanded before globbing is done, and quoting
|
||||||
|
does not normally protect the end separator if it appears in the code.
|
||||||
|
However, if an unquoted metacharacter is used as the separator, its
|
||||||
|
quoted/expanded form is protected.
|
||||||
|
|
||||||
var(string) is then executed as shell code. The string tt(globqual)
|
var(string) is then executed as shell code. The string tt(globqual)
|
||||||
is appended to the array tt(zsh_eval_context) the duration of
|
is appended to the array tt(zsh_eval_context) the duration of
|
||||||
execution.
|
execution.
|
||||||
|
|
|
@ -440,7 +440,7 @@ cindex(globbing qualifiers, enable)
|
||||||
cindex(enable globbing qualifiers)
|
cindex(enable globbing qualifiers)
|
||||||
item(tt(BARE_GLOB_QUAL) <Z>)(
|
item(tt(BARE_GLOB_QUAL) <Z>)(
|
||||||
In a glob pattern, treat a trailing set of parentheses as a qualifier
|
In a glob pattern, treat a trailing set of parentheses as a qualifier
|
||||||
list, if it contains no `tt(|)', `tt(LPAR())' or (if special) `tt(~)'
|
list, if it contains no unquoted `tt(|)', `tt(LPAR())' or (if special) `tt(~)'
|
||||||
characters. See noderef(Filename Generation).
|
characters. See noderef(Filename Generation).
|
||||||
)
|
)
|
||||||
pindex(BRACE_CCL)
|
pindex(BRACE_CCL)
|
||||||
|
|
Loading…
Reference in a new issue