[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Is there a way to know how many arguments are not too long b
From: |
Peng Yu |
Subject: |
[Help-bash] Is there a way to know how many arguments are not too long beforehand? |
Date: |
Fri, 20 Sep 2019 23:30:16 -0500 |
Hi,
$(which echo) {1..10000} >/dev/null
$(which echo) {1..100000}
-bash: /usr/local/opt/coreutils/libexec/gnubin/echo: Argument list too long
For a case like this, the number of arguments should be between 10000
and 100000. But this is dependent on many factors.
Is there a way to get a tight lower estimate of it in bash? xargs has
something that may be useful for this purpose. But I'd like something
native to bash.
$ xargs --show-limits < /dev/null
Your environment variables take up 6677 bytes
POSIX upper limit on argument length (this system): 253419
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 246742
Size of command buffer we are actually using: 131072
Maximum parallelism (--max-procs must be no greater): 2147483647
--
Regards,
Peng
- [Help-bash] Is there a way to know how many arguments are not too long beforehand?,
Peng Yu <=