Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: buglet in zmv help



On Apr 13,  2:15pm, Miek Gieben wrote:
} 
} If I run `run-help zmv` I see the following (only quoting the top half
} of the text):
} 
}     Usage:
}       zmv [OPTIONS] oldpattern newpattern
}     where oldpattern contains parenthesis surrounding patterns which will
}     be replaced in turn by $1, $2, ... in newpattern.  For example,
}       zmv '(*).lis' '\$1.txt'

This appears to be in the usage message in zmv itself.  I'm not sure how
you manage to get that out of "run-help zmv" (I sure don't), but that's
beside the point.

I do wonder when the extra pair of backslashes ceased to be necessary.
Or rather, I wonder when they *became* necessary, because (much) older
versions of zmv don't have five backslashes there, they have only one.
It doesn't seem to matter whether there is one or three, but five is
two too many.

CVS seems to point to this from ChangeLog-4.1:

2002-03-30  Wayne Davison  <wayned@xxxxxxxxxxxxxxxxxxxxx>

   * 16927: zsh/Functions/Misc/zmv: Added -W to auto-convert wildcards in
   both the find and replace strings.  Fixed the usage message to output
   the '$' args and '\' characters (they were getting eaten).

I wonder if there was a backslash parsing bug that was introduced and
then fixed on either side of the time of this change.

(Interestingly, that citation is wrong.  The -W patch is actually 16926,
but does not include the usage message change.  Anyway, shows just how
often anyone looks at the usage message from zmv: once in six years?)

--- ../zsh-forge/current/Functions/Misc/zmv     2007-05-21 22:22:59.000000000 -0700
+++ Functions/Misc/zmv  2008-04-13 08:59:28.000000000 -0700
@@ -148,7 +148,7 @@
   %N [OPTIONS] oldpattern newpattern
 where oldpattern contains parenthesis surrounding patterns which will
 be replaced in turn by \$1, \$2, ... in newpattern.  For example,
-  %N '(*).lis' '\\\\\$1.txt'
+  %N '(*).lis' '\$1.txt'
 renames 'foo.lis' to 'foo.txt', 'my.old.stuff.lis' to 'my.old.stuff.txt',
 and so on.  Something simpler (for basic commands) is the -W option:
   %N -W '*.lis' '*.txt'


-- 



Messages sorted by: Reverse Date, Date, Thread, Author