bug-findutils
[Top][All Lists]
Advanced

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

Suggestion: verbose option. Doc Update: -print and no action are NOT the


From: Peggy Russell
Subject: Suggestion: verbose option. Doc Update: -print and no action are NOT the same
Date: Mon, 28 Mar 2011 17:22:20 -0500
User-agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; )

Hi,

I have a suggestion and documentation update for `find`.

The suggestion for findutils' find is to add a '-t, --verbose' or '--whatif' 
option similar to the '-t' in `xargs`. At a minimum it would show what `find` 
would generate, but it would not execute anything.  Note: The `-D exec` option 
displayed no additional output.

The documentation update is to add a paragraph describing that using the 
default action of `-print` may NOT produce the same result as actually 
supplying the action `-print` because of Boolean operator precedence.

  find -name tmp -prune -o -name \*.txt
  find -name tmp -prune -o -name \*.txt -print

The lack of an action in the first command means it is equivalent to:

  find . \( -name tmp -prune -o -name \*.txt \) -print

This causes tmp to be included in the output.  However for the second find 
command the normal rules of Boolean operator precedence apply, so the pruned 
directory does not appear in the output. 

As described here: http://content.hccfl.edu/pollock/unix/findcmd.htm

Environment:
  find --version
  find (GNU findutils) 4.4.0

Thank you.
Peggy Russell



reply via email to

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