On 11/8/18 12:35 PM, Peng Yu wrote: > Thanks. But I am not getting the same results (not the same number of > echo's) as yours. I am using Mac OS X. Do you know why it is > different? > > $ xargs --show-limits < /dev/null > Your environment variables take up 7701 bytes > POSIX upper limit on argument length (this system): 252395 > POSIX smallest allowable upper limit on argument length (all systems): 4096 > Maximum length of command we could actually use: 244694 > Size of command buffer we are actually using: 131072 > Maximum parallelism (--max-procs must be no greater): 2147483647 > > $ yes . | head -n $(bc <<< '131072/2 - 3') | xargs -tn 200000 2>&1 | > tr -d '[. ]' > echo > echo > > echo > > echo > echo > echo > echo > > echo > > echo > > $ yes . | head -n $(bc <<< '131072/2 - 2') | xargs -tn 200000 2>&1 | > tr -d '[. ]' > echo > echo > > echo > > echo > echo > echo > echo > > echo > > echo >
That also depends on a few other factors like .e.g. "env headroom', see https://git.sv.gnu.org/cgit/findutils.git/tree/xargs/xargs.c#n427 from line 427 until line 510. I don't have Mac OS X, so I can't step through what's the limiting factor in your case. What's your actual concern? I mean, depending on what COMMAND does, the overhead of calling ~10 instead of 1 process in the ideal GNU/Linux case for exactly that amount of arguments still looks okay to me. Have a nice day, Berny