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

Re: strange glob expansion



Peter Stephenson (pws@xxxxxx) wrote:
> "Bart Schaefer" wrote:
> > Adam Spiers <adam@xxxxxxxxxx> wrote:
> > } The upshot of this is that to match all Perl modules starting with `L'
> > } below the cwd, I have to use L{*/**/*,}.pm instead of L**/*.pm.
> > 
> > What?  L{*/**/*,}.pm is first brace-expanded to L*/**/*.pm and L.pm, and
> > then globbed.  There probably isn't an L.pm, so that matches in any sub-
> > directory whose name starts with L and all its subdirectories, all the
> > files whose names end with .pm.  You could have done that without the
> > braces, with L*/**/*.pm, but I suspect what you meant was */**/L*.pm.
> 
> I think the answer is **/L*.pm --- as remarked by someone a day or two ago,
> **/ can match (very usefully, but slightly counterintuitively given the /)
> in the current directory too.  For example, in /usr/local/lib/perl5
> `ls **/A*.pm' gives me:
>   AnyDBM_File.pm   AutoLoader.pm    AutoSplit.pm     Text/Abbrev.pm

No, I was after all Perl modules starting with `L' in the sense that I
would say that Text::Abbrev started with `T' rather than `A'.  (I
later replace all `/' in the result of the expansion with `::'.)  So I
did mean L**/*.pm, not **/L*.pm.  However, as Bart rightly guessed,
L{*/**/*,}.pm was a load of rubbish.  I actually meant L*{/**/*,}.pm.
Is there a better way of achieving this?



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