Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zmv -W/-w in subdirs, possibly patch
- X-seq: zsh-workers 27246
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: zmv -W/-w in subdirs, possibly patch
- Date: Sun, 6 Sep 2009 01:29:50 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=jN9IYONOpPaEpbTyfnvPB+n6lEp5Mp43UVTpn5iOI64=; b=UKR6zta9Tw8Qcf+YuGq7lERTsKkfVcyTWfnMwC/llxfx4rbVuo48SU8Cv+/x2fKJRs Yob6zArROuikFopwEWM5ZwmluPD8hb4vWZ4SCvuGuuapajnpn8cIxcA1nbiKtvxlJKlB at2mNBxt2oTyPEpt6kjuX1/zKJLyV7G7z3pOg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=J7i8zR4wdJavjMutX6g0vGIwpZI+CQKFgI8KL308+NQNr6luf0z1ki2JmQsgGg3a46 P/pYoyJBcouhX4ZOpitCFQHNzP6Kjyg20g9XhC8/qtQd+2aK3VjIwZL6/6CP6hVSLKuE xj38BNU70dSNFOXQfNumtCcASEbrY0R7SK28o=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author