zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Zach Riggle" <zachriggle@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Compound Glob Specifiers
Date: Mon, 08 Nov 2021 22:04:12 -0500	[thread overview]
Message-ID: <045dfcff-08b4-4a16-90f6-ad7867e1996d@www.fastmail.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2021-11-09  3:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 23:03 Zach Riggle
2021-11-09  3:04 ` Lawrence Velázquez [this message]
2021-11-09  3:30 ` Bart Schaefer
2021-11-09  7:52 ` Mikael Magnusson

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=045dfcff-08b4-4a16-90f6-ad7867e1996d@www.fastmail.com \
    --to=larryv@zsh.org \
    --cc=zachriggle@gmail.com \
    --cc=zsh-users@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).