Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Efficient way to map a list of values to multiple processes, then accumulate their output



Ah-ha! Okay!  I took "works exactly like xargs" a little too literally and didn't read the docs closely enough.

As always, thanks for your help guys!

Zach Riggle



On Sat, Nov 6, 2021 at 5:56 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
On Sat, Nov 6, 2021, at 5:58 PM, Zach Riggle wrote:
> A very simple test works exactly correct, but a slight variation gives
> me "zargs: argument list too long":

From your gist:

> # Works
> zargs -P12 -n1 -- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -- wrapper1

> # Does not work --> zrgs: argument list too long
> zargs -P12 -n1 -- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -- wrapper2 double

From zshcontrib(1):

    zargs [ option ... -- ] [ input ... ] [ -- command [ arg ... ] ]

        [...]

        The options -i, -I, -l, -L, and -n differ slightly from their
        usage in `xargs`.  There are no input lines for `zargs` to
        count, so -l and -L count through the "input" list, and -n
        counts the number of arguments passed to each execution of
        "command", *including* any "arg" list.

So you actually want -n2.  (Adjust to taste.)

--
vq


Messages sorted by: Reverse Date, Date, Thread, Author