[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #52409] `find -print0 -name ...` ignores `-name ...`
From: |
Dale Worley |
Subject: |
[bug #52409] `find -print0 -name ...` ignores `-name ...` |
Date: |
Tue, 14 Nov 2017 21:23:51 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 |
Follow-up Comment #1, bug #52409 (project findutils):
Actually, this is a usage error: -print is an action as well as a predicate.
In particular, it takes effect when it is executed *in order* among the
predicates. So if you execute
find . -name '*.c' -print
find will, for each file name, first test to see if it passes the -name test,
and then if it does, test to see if it passes the -print test. -print always
succeeds, but as a side-effect, it prints the name. And consecutive
predicates are implicitly connected by "and", or rather, the short-circuiting
"&&" operator of C.
If you execute
find . -name '*.c' -print -print
it will print every *.c name *twice*, as there are two -print predicates to
execute.
If you execute
find . -name '*.c'
it will print every *.c name once, because find appends -print to command
lines that have no side-effect-causing predicates.
If you execute
find . -print -name '*.c"
find will, for each name, first print it and then test if it matches *.c.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52409>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/