I want to run the command
find some/path -exec program \\{} \\;
but I want the find command to quit as soon as the command
Here is my example for a "build system", which stops after hitting the first compiler error (based on Kojiro's answer, which did not exaclty work for me):
(The need for escaped parentheses is real. I know that hurts.)
find -name '*.cpp' \( -print -a -exec g++ -c {} \; -o -quit \)
I want to build a static library of basically all C++ files located in the current directory and below.
Before running the compiler I want to have the file -print
-ed, then -exec
-ed, but when it fails (and leaves errors on stderr
, it should -quit
.
-a
is like &&
and -o
is like ||
in shell or C.
Without the parentheses, GNU find "optimizes" the query, by trying the most probable condition first, which is -- I guess -- -quit
.