Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Compound Glob Specifiers
- X-seq: zsh-users 27333
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Zach Riggle" <zachriggle@xxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Compound Glob Specifiers
- Date: Mon, 08 Nov 2021 22:04:12 -0500
- Archived-at: <https://zsh.org/users/27333>
- In-reply-to:  <CAMP9c5kG4cR7QxMu93cLeZn_4BmZht=toAijxj4GvnKbYMm5Gw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References:  <CAMP9c5kG4cR7QxMu93cLeZn_4BmZht=toAijxj4GvnKbYMm5Gw@mail.gmail.com>
On Mon, Nov 8, 2021, at 6:03 PM, Zach Riggle wrote:
> *(/) is the glob specifier for directories [1]
>
> [...]
>
> [1] 
> https://zsh.sourceforge.io/Doc/Release/Expansion.html#index-BARE_005fGLOB_005fQUAL_002c-use-of
From that URL, except immediately above the anchor (emphasis mine):
    Patterns used for filename generation may *end* in a list of
    qualifiers enclosed in parentheses.
> It would then follow that *(/)/*(/)/somefile would match 
> dir/dir/somefile and not dir/link/somefile.
>
> This is not the case -- even *(/)/ (i.e. appending a trailing slash to 
> all directories) do not work out-of-the-box as one might expect.
Since your instances of (...) do not terminate your patterns, they
are interpreted as delimiters for grouping [*].  Another example:
    % touch /tmp/foo
    % print -r -- /*(p)/foo
    /tmp/foo
Clearly (p) is not acting as a glob qualifier here, as /tmp is not
a FIFO.  That pattern is equivalent to /*p/foo.
[*]: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Glob-Operators
> I've read through 14.8 Filename Generation [2] as best I can (my 
> favorite hack being the NTREF=reffile bit) but haven't found anything 
> that suggests how one might do this.
I'll leave that for someone else, as I don't have any suggestions
at the moment.
-- 
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author