Skip to main content.

2005-Oct-12

Last week, I added support to find(1) to output to a file for different expressions. The following is a bad example (because I need to add a "-false" primary.)
$ time find / ( -name "[aeiou]*" -fprint ~/vowel ) -o    ( -group operator -fprint ~/operator ) 2>~/errors
35.12s real     0.52s user     3.38s system
$ time find / -name "[aeiou]*" 2>/home/reed/errors.2 1>/home/reed/vowel.2
36.15s real     0.39s user     1.55s system
$ time find / -group operator 2>/home/reed/errors.3 1>/home/reed/operator.3
36.58s real     0.41s user     3.52s system
I reviewed results and it didn't show me what I expected. Because the vowels matched early, then the files owned by group operator that also started with a vowel didn't match.
$ time find / ( -name "[aeiou]*" -fprint ~/vowel.4 ) -a    ( -group operator -fprint ~/operator.4 ) 2>~/errors.4     <
37.35s real     0.72s user     3.45s system
Using the above "-a" for "and" expression also did not work. As my operator.4 file only had files beginnning with a vowel.

findutils's find(1) has same behaviour. I see that findutils's find(1) adds a "-false" primary for "Always false." This makes it work! So I will need to code that next.

So I added the -false primary. And it works like I expect. findutils also has a "," operator that behaves the same.

I committed the -fprint support to src/usr.bin/find. (I did not commit -false yet.) I forgot to update the .Dd date in the man page.