find utility ignores complex search expressions when '-print*' is used. Steps to Reproduce: 1. Lookup any source directory with many *.c and *.h files. 2. find /path/to/source -name "*.h" -or -name "*.c" | grep '\.c$' 3. find /path/to/source -name "*.h" -or -name "*.c" -print | grep '\.c$' Actual Results: Files with second wildcard are ignored, only first wildcard is handled correctly. Expected Results: All wildcards should be handled.
The 3rd case is equivalent of find /path/to/source -name "*.h" -or "(" -name "*.c" -print ")" you probably want to use find /path/to/source "(" -name "*.h" -or -name "*.c" ")" -print