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

Re: how to?



On 2002-08-27 at 12:34 +0200, Roman Neuhauser wrote:
> From: Scott Lipcon <slipcon@xxxxxxxxxx>
> > I'd like to be able to do an ls in a directory of source code while
> > its being built, and basically say: show me all the .c files for which
> > there doesn't exist a .o file.   Right now I'm using:
> > 
> > ls -1 *.[co] | cut -f 1 -d"." | uniq -c | grep 1

>     This made me look in the uguide, and looks like there's a variation
>     of this is (requires EXTENDED_GLOB):
> 
>     % print *.c~f*
> 
>     it works in this form, but isn't usable for the original task.
>     Neither my copy of zsh manual nor user guide mention that this
>     shouldn't work, but it doesn't:
> 
>     roman@freepuppy ~/tmp/foo 1030:0 > ls
>     bar.c   bar.o   baz.c   baz.o   foo.c
>     roman@freepuppy ~/tmp/foo 1031:0 > ls *.c~f*
>     bar.c   baz.c
>     roman@freepuppy ~/tmp/foo 1032:0 > ls *.c~*.o
>     bar.c   baz.c   foo.c
>     roman@freepuppy ~/tmp/foo 1033:0 > 
> 
>     could anyone explain this to me?

The extended glob used excludes those filenames which match the second
glob.  The first one excludes filenames starting with "f".  The second
excludes those ending ".o".

If a filename ends ".c" then it can not also, at the same time, end
".o".

This says nothing about whether or not there exists a different filename
which has the same basename, but ends ".o" instead of ".c".
-- 
Some mornings it's just not worth gnawing through the straps.

Attachment: pgpqyY0nbJMN8.pgp
Description: PGP signature



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