[kony@HOSTNAME testing]$ pwd
/apps/kony/fmw/testing
[kony@HOSTNAME testing]$ touch SCCS
[kony@HOSTNAME testing]$ touch NOT_SCCS
[kony@HOSTNAME testing]$
[kony@HOSTNAME testing]$ find . -name SCCS -prune -o -print
.
./NOT_SCCS
[kony@HOSTNAME testing]$
[kony@HOSTNAME testing]$
I am trying to understand how Logical operators work in find and how it affects prune.
- First Find command .
It will be treated as "find . -name SCCS -and -prune -o -print" . (An implicity -and between name and -prune action.
For every file and directory in current directory first "-name SCCS" condition will be checked. If name matches SCCS then the condition is true . Since First condition is true and "-and" is mentioned it will check next condition . next condition is "-prune" it will be evalvauted to true . So it will be like
"find . true -and true -o -print" which means "find . true -o -print" . Since left condition is true and there is -or operation then next condition will be evaluated which is -print.
This means that it should print file whose name is SCCS . Then why it is not printing. Am i understanding it wrongly.