On 2007-11-01 at 19:24 -0500, Peter da Silva wrote:
> On 01-Nov-2007, at 19:16, A. Pagaltzis wrote:
>> Well find will get on your case if you mix paths and predicates
>> anyway.
> 
> Yes, they could have just had one token to say "that's the last file, the 
> rest is an expression". That would also have worked.

-prune is an action, not a selector.

If people learn -prune, I find (hah!) that they suddenly start to
understand find(1) better, as things click.

find blah -whatever -prune -o -whichever -print

Eg:
$ find /dev \( -type b -o -type c \) -prune -o -print

This is informative on FreeBSD:
$ find -L /dev \( -type b -o -type c \) -prune -o \! -type d -print
(spots the socket)

whilst this Ubuntu derivative has so much crap littering about the
filesystem that it's necessary to instead:
$ find /dev \( -type b -o -type c \) -prune -o \! \( -type d -o -type l \) 
-print


Now, if someone seems to be doing well in an interview (understanding
quoting is done by the shell would be a nice enough change) then it's
fun to check if they can spot the security hole in
$ find /tmp -blah -print0 | xargs -0 rm --

And yeah, if you know the answer then, uhm, can I tempt you to apply for
a job?  :)

Reply via email to