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.
Dale
