This question already has an answer here:
I have a directory with the following files and a
.git directory, e.g.
. ├── .git │ ├── branches │ ├── COMMIT_EDITMSG │ ├── packed-refs │ └── refs ├── readme.md ├── server_build.sh └── tags
If I run GNU
find command with the
find prints the directory which is
% find . -name '.git' -prune ./.git
If add another OR option, then the directory which is pruned not longer appears in the output:
% find . -name '.git' -prune -o -name '*.md' -print ./readme.md
In this case, both
-name '.git' and
-name '*.md' tests must be returning true, it can't be possible that adding another OR test suddenly makes the
-name '.git' -prune test untrue.
Is there some implicit switch being added to the first statement?
In other words is find turning
find . -name '.git' -prune
find . -name '.git' -prune -print
at run time? and the implicit
find print the -prune'd directory when another "-or" test is applied?