Hi Dale, On Thu, Oct 30, 2025 at 11:02:33AM -0400, Dale R. Worley wrote: > Of course, > > xargs grep regex > > is tricky to handle because you want grep to produce exit statuses that > xargs will process to produce the exit status you want. > > I think this will get the effect you want: > > ... | xargs bash -c "grep $regex ; [[ \$? -le 1 ]]' > > and it runs grep no more times than "xargs grep" will.
The problem with something based on
... | xargs bash -c ...
is that it would make it easy to inject commands in the bash script with
malicioulsy crafted files, right? It sounds scary.
Have a lovely day!
Alex
>
> Dale
--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
signature.asc
Description: PGP signature
