I found this weird behavior in find
. Depending on the order of the parameters to find
it finds different files.
For example, I have a directory tree with the following content.
.
├── configure.ac
├── Makefile.am
└── src
├── hello.c
└── Makefile.am
if I run
find -name '*.cpp' -o -name '*.[chS]' -print0 | xargs -0 echo
It lists
./src/hello.c
And if I run
find -name '*.[chS]' -o -name '*.cpp' -print0 | xargs -0 echo
It doesn't list anything. Notice that the only thing I changed is the order of the file name.
Can anyone explain why the second command doesn't list any files?