If I do
find . -exec echo {} +
it prints all paths in one line, i.e. command echo
is only executed once.
But according to man find
,
-exec command {} + ... the number of invocations of the command will be much less than the number of matched files. ...
It seems that in some circumstances the command will be executed multiple times. Am I right? Please exemplify.
Best Answer
POSIX defined
find
-exec utility_name [argument ...] {} + as:When length set of file name you found exceed system
ARG_MAX
, the command is executed.You can get
ARG_MAX
using getconf:On some system, actual value of
ARG_MAX
can be different, you can refer here for more details.