3 ms·
find $file_filters -type f -exec grep $pattern {} +
by jolmg 5y ago
find $file_filters -type f -exec grep $pattern {} +
- wahern 5y agofind will only pass up to ARG_MAX arguments to each invocation of grep. > If the primary expression is punctuated by a <plus-sign>, the primary shall always evaluate as true, and the pathnames for which the primary is evaluated shall be aggregated into sets. The utility utility_name shall be invoked once for each set of aggregated pathnames. [...] The size of any set of two or more pathnames shall be limited such that execution of the utility does not cause the system's {ARG_MAX} limit to be exceeded. [....] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f...
- deleted 5y ago[deleted]
- jolmg 5y agoThat limit is not specific to `find`. It applies to the `exec` family of functions. There's no way around it, so it also applies to globbing, command substitution, etc. Also, it's not ARG_MAX arguments; it's ARG_MAX byte length for the argument list, in addition to, on Linux, the environment list. A modern Linux machine has it set over 2,000,000, so it can easily fit 1,000 arguments.