The following example in Linux find man page doesn't seem to work:
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
In this example, -prune prevents unnecessary descent into directories
that have already been discovered (for example we do not search
project3/src because we already found project3/.svn), but ensures
sibling directories (project2 and project3) are found.
The find displays no output. Does anybody know why? I noticed this find had no tests since "-exec" clause are actions not tests (can an action be a test too?). and since "-or" has lower precedence than implied "-and" between the last "-exec" and "-print", the logic expressed in the command line doesn't seem to be what it was intended to be.
>uname -r
2.6.32-131.0.15.el6.x86_64
>pwd
/var/tmp
>mkdir -p repo/project1
>mkdir -p repo/gnu/project2
>mkdir -p repo/gnu/project3/src
>mkdir -p repo/project4
>touch repo/project1/CVS
>touch repo/gnu/project2/.svn
>touch repo/gnu/project3/.svn
>touch repo/gnu/project3/src/.svn
>touch repo/project4/.git
>find repo
repo
repo/project4
repo/project4/.git
repo/gnu
repo/gnu/project3
repo/gnu/project3/src
repo/gnu/project3/src/.svn
repo/gnu/project3/.svn
repo/gnu/project2
repo/gnu/project2/.svn
repo/project1
repo/project1/CVS
>find repo/ -exec test -d {}/.svn \; -or -exec test -d {}/.git \; -or -exec test -d {}/CVS \; -print -prune
>