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

Re: how can I skip globbing through SCCS subdirs?



John.Cooper@xxxxxxxxxxx wrote:
> I'm using extendedglob.  How can I match all .c files in all
> subdirectories, _except_ any SCCS subdirectories?
> 
> ls **~SCCS/*.c

The bad news is that ** handling bypasses most of the pattern code,
i.e. you can't actually exclude things while the ** list is being
expanded.  The good news is that in the ~ part of the pattern, /'s are
not special.  This means you can exclude SCCS directories like this:

ls **/*.c~(*/)#SCCS/*

The (*/)# is a trick so that top level SCCS directories are ignored as
well as any /SCCS/ bits in the middle somewhere.

By the way, as this shows, ~ has lower precedence than /.  That's
because it was originally intended that you only use ~ the way I've
just done, i.e. with the whole pattern.  However, you can now group it
using parentheses if you avoid using ** inside the parentheses (so it
doesn't solve your problem here).

> Ps. Is there a newsgroup for this alias?

No, sorry.

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



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