Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is this a bug?
- X-seq: zsh-users 27672
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Perry Smith <pedz@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Is this a bug?
- Date: Tue, 19 Apr 2022 23:53:29 +0200
- Archived-at: <https://zsh.org/users/27672>
- In-reply-to: <CAH+w=7ZUkzTRZf-G9EOjXXc6i36iD41Mn34MVN_rDggoOeKTdg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <F5B10854-2086-43AE-9077-EC071034BFBC@easesoftware.com> <CAH+w=7aF2YLcsc2upXQnMosacNZ5SffhaOa0g-W7t73zhy=iOw@mail.gmail.com> <292BA5B4-7D2C-4D2F-8C45-EE599D4A43D6@easesoftware.com> <CAH+w=7ZPORLXe2VrkLPwJk=0LH+gnRjqZ5kLq+J9mAog=reYaQ@mail.gmail.com> <CAHYJk3ReponW2rTV7OBG_sAxXoDhWm6Ds68QujEF-p=weRhd4Q@mail.gmail.com> <CAH+w=7ZUkzTRZf-G9EOjXXc6i36iD41Mn34MVN_rDggoOeKTdg@mail.gmail.com>
On 4/19/22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Apr 19, 2022 at 10:13 AM Mikael Magnusson <mikachu@xxxxxxxxx>
> wrote:
>>
>> Hmm?
>> % mkdir -p {a,Volumes}/{b,Volumes}/{c,Volumes}
>> % print -l ((^Volumes)/)#
>> a/
>> a/b/
>> a/b/c/
>
> Sure, but try ((^Volumes)/)#/ and suddenly you're recursing from the root.
There's no reason to append this extra slash, (foo/)#hello works fine
to match bar/hello (but not /hello).
% touch a/b/c/hello
% print -l ((^Volumes)/)#hello
a/b/c/hello
> For Perry's specific use case, ./((^Volumes)/)#/ is OK, because he
> only cares about directories, bad things can happen if you end that
> with another glob. I discounted ./((^Volumes)/)#/(^Volumes) but
> that's because it runs afoul of bare_glob_qual, it works if you unset
> that or append some other qualifier to force (^...) to be taken as a
> pattern.
Afaict, ((^Volumes)/)#^Volumes should work fine there.
% touch **/*(/e*'REPLY+=/bar'*)
% print -l ((^Volumes)/)#^Volumes
a
a/b
a/b/bar
a/b/c
a/b/c/bar
a/b/c/hello
a/bar
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author