URL:
  <http://savannah.gnu.org/bugs/?49453>

                 Summary: find man page erroneous example
                 Project: findutils
            Submitted by: andreyhsiao
            Submitted on: Thu 27 Oct 2016 04:00:28 AM GMT
                Category: documentation
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
           Fixed Release: None

    _______________________________________________________

Details:

Below example does not return expected results from the find man page EXAMPLES
section.

"""
  find repo/ -exec test -d {}/.svn \; -or \
    -exec test -d {}/.git \; -or -exec test -d {}/CVS \; \
    -print -prune

  Given the following directory of projects and their associated SCM
administrative directories, perform an efficient search for the projects'
roots:

    repo/project1/CVS
    repo/gnu/project2/.svn
    repo/gnu/project3/.svn
    repo/gnu/project3/src/.svn
    repo/project4/.git
"""

The command won't work as expected since 'and' has higher precedence than
'or'.

Adding the parentheses should fix the issue.

find repo/ \( -exec test -d {}/.svn \; -or \
  -exec test -d {}/.git \; -or -exec test -d {}/CVS \; \) \
  -print -prune







    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


Reply via email to