[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parallel script with variable name
From: |
Ole Tange |
Subject: |
Re: Parallel script with variable name |
Date: |
Tue, 5 Mar 2019 19:46:02 +0100 |
On Thu, Feb 28, 2019 at 9:13 AM Ernst, Kevin <Kevin.Ernst@cchmc.org> 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Parallel script with variable name,
Ole Tange <=