Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Inconsistent behavior with comparisons and recursive glob patterns
- X-seq: zsh-workers 52913
- From: Alan Wagner-Krankel <awk@xxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Inconsistent behavior with comparisons and recursive glob patterns
- Date: Sun, 5 May 2024 01:29:24 -0500
- Archived-at: <https://zsh.org/workers/52913>
- In-reply-to: <CAH+w=7Zp3uXAD6uP+gryphWFVqhhg1EDHioJCNqu5e0Mr6e5LA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGZNKjL2cJhLopFPAFFTewh2cHxX+_L4vMx2Nf9bAS0ud58RBw@mail.gmail.com> <c97c8fe9-2f56-45b7-bfb2-9f2a97283859@gmx.com> <CAH+w=7YcdDM6enW37=j3LvOaBnPvazvE9DcHKiJ7VSz-zF7SgQ@mail.gmail.com> <CAH+w=7Zp3uXAD6uP+gryphWFVqhhg1EDHioJCNqu5e0Mr6e5LA@mail.gmail.com>
I dug through StackOverflow a bit to see if I could find how folks in
the wild were expecting zmv to work. Interestingly, most of the posts
that called zmv with `**/` and '$f' were by the same author. In one if
them (https://unix.stackexchange.com/a/271816), they explicitly stated
that "zmv '(**/)(*)' $1$2..." and "zmv '**/*' '$f...'" were
equivalent.
In the absence of a specific statement in the documentation about
'**/' and '$f', it seems safe to assume that the intended spec was
that '**/' would behave the same with the various zmv flavors as it
does in other situations.
Thanks,
Awk
On Tue, Apr 30, 2024 at 3:09 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> (Moved from -users)
>
> On Tue, Apr 30, 2024 at 11:15 AM Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > I suspect there's no explicit reasoning in zmv. **/ is specifically
> > handled in the case of zmv -w/-W (workers/27247) but not for '$f'
> > placeholders.
> >
> > It works if you do this:
> >
> > zmv -n '(**/)f?' '$f.txt'
> >
> > Whether it should also work without the parens and also without the -w
> > option is unclear.
>
> Attached patch makes it work without the parens. Is this within spec?
> It's hard to tell from the solitary '$f' example in the doc.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author