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

()# vs. ()## question



I've scratched my head about this one for quite a while now.  Maybe
someone can explain, please?  I've been playing with **/ and ***/;
these are pretty straightforward.  Then I started playing with
(x/)# and (x/)##, where x is an arbitrary pattern.  I'm confused.

For testing, I've made a directory with three subdirectories named
server1, server2 and server3.  Each of those subdirectories has
subdirectories named 97, 98 and 99.  Each of those subdirectories has
subdirectories named 01 through 12:

    zsh$ mkdir -p server{1..3}/{97..99}/{01..12}

So there are lots of relative pathnames like serverN/YY/MM, where YY
is a two-digit year and MM is a two-digit month.  I want to match YY
and MM with repeated ??/ patterns.

The first one example below works the way I expect it to.  But I
don't see why the second example is matching "server1/".

    zsh$ echo server?/(??/)#
    server1/ server1/00/ server1/00/01/ server1/00/02/ ...many more...

    zsh$ echo server?/(??/)##
    server1/ server1/00/ server1/00/01/ server1/00/02/ ...many more...

The first one makes sense because, I think, "(??/)#" matches zero or
more occurrences of "??/" -- so it doesn't have to match any of the
subdirectories, so just plain "server1/" matches.  But, in the second
example, shouldn't "(??/)##" force the pattern to match one or more
occurrences of "??/" -- and, so, not allow plain "server1/" to match?

I tried this first with version 3.0.7 (Linux), then read the bug list
and decided to try the fix in 3.1.3.  Now I have 3.1.9, but it didn't
help.  Can anyone straighten me out on this?  Thanks a lot.

Jerry
-- 
Jerry Peek, jpeek@xxxxxxxxx, http://www.jpeek.com/



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