On Thu, Feb 28, 2019 at 9:13 AM Ernst, Kevin <[email protected]> wrote:

> It most cases, it’s fine, but in general it’s more conservative to let the 
> shell itself do wildcard expansion, or to use find rather than ls, as 
> discussed here (tl;dr: “word splitting”).

One small addition: Having the shell expand the wildcards can lead to
a command line that is too long. Then you get something like:

  bash: parallel: Argument list too long

So the bullet proof and guaranteed safe way (with no exceptions) is to do:

  printf '%s\0' *.log | parallel -0 do_stuff

This deals correctly with:

* File names containing newline (\n)
* More file names than fit on the command line

https://www.gnu.org/software/parallel/man.html#EXAMPLE:-Inserting-multiple-arguments

/Ole

Reply via email to