zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: zmv -W/-w in subdirs, possibly patch
Date: Sun, 6 Sep 2009 01:29:50 +0200	[thread overview]
Message-ID: <237967ef0909051629x73f79a43v49d9baa573c5b19@mail.gmail.com> (raw)

Hi,

% ren */*.JPG */*.jpg
zmv:232: bad pattern: (*/)(*).JPG

--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -187,7 +187,7 @@ if [[ -n $opt_w || -n $opt_W ]]; then
   # Well, this seems to work.
   # The tricky bit is getting all forms of [...] correct, but as long
   # as we require inactive bits to be backslashed its not so bad.
-  find='(#m)((\*\*#/|[*?]|<[0-9]#-[0-9]#>|\[(^|)(\]|)(\[:[a-z]##:\]|\\?|[^\]])##\])\##|?\###)'
+  find='(#m)((\*\*#|[*?]|<[0-9]#-[0-9]#>|\[(^|)(\]|)(\[:[a-z]##:\]|\\?|[^\]])##\])\##|?\###)'
   tmp="${pat//${~find}/$[++cnt]}"
   if [[ $cnt = 0 ]]; then
     print -r -- "$myname: warning: no wildcards were found in search
pattern" >&2

%  ren */*.JPG */*.jpg
[the files are renamed successfully]

My question is: Why was the / there in the first place? Would the
above patch break any existing usecases?
(in case it is hard to spot, the patch removes the only / on the
line). If it does break some weird complex
pattern, maybe I would argue that you should not use -w then.

-- 
Mikael Magnusson


             reply	other threads:[~2009-09-05 23:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 23:29 Mikael Magnusson [this message]
2009-09-06 18:48 ` Peter Stephenson
2009-09-06 21:29   ` 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=237967ef0909051629x73f79a43v49d9baa573c5b19@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /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).