bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find . -path '*/.gork' -prune -o -type f : prints ".gork"


From: Andreas Schwab
Subject: Re: find . -path '*/.gork' -prune -o -type f : prints ".gork"
Date: Thu, 9 Nov 2000 05:22:08 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.90

address@hidden (David M. Karr) writes:

|> >>>>> "Bob" == Bob Proulx <address@hidden> writes:
|>   >> find . -path '*/.gork' -prune -o -type f
|>   >> 
|>   >> I would expect it to just print "testdir/subdir/foo".  The "find" man
|>   >> page gave me this impression in the description of the "-path"
|>   >> option.  However, it also prints "testdir/.gork".  It didn't print
|>   >> "testdir/.gork/stuff", but it did print the ".gork" directory entry.
|>   >> How can I make "find" not even print the directory entry for ".gork"
|>   >> (without piping it into a "grep -v" command)?
|> 
|>   Bob> Perhaps you could try using an explicit -print argument.  The -print
|>   Bob> is a default if you don't specify it.  If you do specify it then it
|>   Bob> applies exactly as you asked for it.  This is relatively new
|>   Bob> functionality for find which in the past has not made that assumption
|>   Bob> and would print nothing at all unless you specifically asked for it.
|>   Bob> There might be dragons in the area of defaulting to printing.  Better
|>   Bob> to be explicit.
|> 
|>   Bob>   find . -path '*/.gork' -prune -o -type f -print
|> 
|> This is really strange.  As you describe, without the "-print" on the
|> end, it prints the directory name I wanted to skip.  With "-print" on
|> the end, it doesn't print that directory.  That's the behavior that I
|> want.  Is it possible to explain WHY it works this way without
|> confusing me even more?

Note that `find . -path '*/.gork' -prune -o -type f' is equivalent to
`find . \( -path '*/.gork' -prune -o -type f \) -print', ie, -print is
added at the outer level; but `-o' binds lower than `-a', thus in the
second case you have `find . -path '*/.gork' -prune -o \( -type f -print \)'.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
address@hidden
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]