[bug #65895] Expression order matters?
Tavian Barnes <[email protected]>
| Newsgroups | gmane.comp.gnu.findutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Follow-up Comment #6, bug #65895 (group findutils):
[comment #5 comment #5:]
> Sorry I didn't make myself clear enough. I wasn't suggesting that "find .
-delete" stop working. I was suggesting that it become an error for -delete to
be followed by one or more pure predicate options (e.g. -name) but no
side-effect options (e.g. -exec).
I like that idea, so I added it in bfs 4.0
(https://github.com/tavianator/bfs/releases/tag/4.0)
$ bfs -delete -name a
bfs: warning: bfs -delete -name a
bfs: warning: ~~~~~~~
bfs: warning: The result of this expression is ignored.
bfs: warning: Do you want to continue? n
> It's not the same thing, since such commands would never have been
intentional or valid. Even if someone did want to delete all files and list a
subset of them (for example), they would find that that didn't work,
presumably because the files are deleted before their names are checked
That's not why; the real reason is that any action (like `-delete`) suppresses
the implicit `-print` action. If you add it back explicitly you'll get what
you expected:
$ find -delete -name a -print
./a
Though it is very fragile to do much with a deleted file:
$ find -delete -name a -links +0 -print
find: ‘./a’: No such file or directory
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65895>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCZr9pCwAKCRCqLAuaBUf3 TprAAQDk4B+VnLiO+E3pUxG1L7/6KBBwlMvcpsQd8LJsXZT0YAD+JNsD9nQE2/Ua KLlsUNhJVcg05s8DI2UaBpGXByGwRQQ= =S45J -----END PGP SIGNATURE-----