bug-findutils
[Top][All Lists]
Advanced

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

[bug #17587] print0 action causes false results to be printed


From: Andreas Metzler
Subject: [bug #17587] print0 action causes false results to be printed
Date: Sat, 2 Sep 2006 10:05:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060803 Debian/1.7.8-1sarge7.2.1

Follow-up Comment #1, bug #17587 (project findutils):

Hello,
as you already guessed this is no bug.

<quote>
The expression is made up of options (which affect overall operation rather
than the processing of a specific file, and always return true), tests (which
return a true or false  value),  and actions  (which  have  side effects and
return a true or false value), all separated by operators.  -and is assumed
where the operator is omitted.

If the expression contains no actions other than -prune, -print is performed 
on  all  files  for  which  the expression is true.
<unquote>

So the whole thing is depending on the order the options, tests and commands
are specified.

-------------------
address@hidden:/tmp/findtest$ echo blah > notempty ; touch empty
address@hidden:/tmp/findtest$ find -size 0 -print
./empty
address@hidden:/tmp/findtest$ find -print -size 0
.
./notempty
./empty
address@hidden:/tmp/findtest$ find -print -size 0 -print
.
./notempty
./empty
./empty
-------------------

The second command *FIRST* prints all entries and afterwards checks their
size (and does nothing with result of the test as there is no action
specified and because the commandline already contains an action, the
"-print"). The first command does what you wanted it to do.

The third one illustrates the point, it prints all entries, *then* checks the
size and prints the entries with size=0.

hth, cu andreas

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?17587>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/





reply via email to

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