zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Inconsistent behavior with comparisons and recursive glob patterns
Date: Tue, 30 Apr 2024 11:15:00 -0700	[thread overview]
Message-ID: <CAH+w=7YcdDM6enW37=j3LvOaBnPvazvE9DcHKiJ7VSz-zF7SgQ@mail.gmail.com> (raw)
In-Reply-To: <c97c8fe9-2f56-45b7-bfb2-9f2a97283859@gmx.com>

On Tue, Apr 30, 2024 at 1:15 AM Alan Wagner-Krankel <awk@awkwork.com> wrote:
>
> > zmv -n '**/f?' '$f.txt'
> mv -- d1/d2/f2 d1/d2/f2.txt
> mv -- d1/f1 d1/f1.txt
> > zmv -n '(*/)#f?' '$f.txt'
> mv -- d1/d2/f2 d1/d2/f2.txt
> mv -- d1/f1 d1/f1.txt
> mv -- f0 f0.txt
>
> I think both zmv calls should have attempted to update the 'f0' file
> in the base directory. Am I missing something?

On Tue, Apr 30, 2024 at 7:11 AM Eric Cook <llua@gmx.com> wrote:
>
> ```
> Pattern metacharacters are active for the pattern arguments; the patterns  are
> the  same  as those used for filename generation, see zshexpn(1), but there is
> no special behaviour of ‘/' nor initial dots, and no glob qualifiers  are  al‐
> lowed.
> ```
>
> I'll leave zmv's implementation for someone else to answer but i suspect the reasoning is similar.

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.


      reply	other threads:[~2024-04-30 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  8:14 Alan Wagner-Krankel
2024-04-30 14:11 ` Eric Cook
2024-04-30 18:15   ` Bart Schaefer [this message]

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='CAH+w=7YcdDM6enW37=j3LvOaBnPvazvE9DcHKiJ7VSz-zF7SgQ@mail.gmail.com' \
    --to=schaefer@brasslantern.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).