Context for the question: According to POSIX specs, ARG_MAX is maximum length of command-line arguments to exec() family of functions. Which lead me to believe that's actual number of arguments, however that clearly didn't work:
$ ulimit -s
8192
$ touch {1..18000}.jpg
$ rm *.jpg
$
Clearly, this works fine, despite being in length over 8192 items. According to D.W.'s answer, the 8192 is supposedly size in kB. So clearly the previous assumption was wrong.
This is where the actual question comes in: How do I figure out the amount of items that actually will get above 8192 kB limit ? In other words, what sort of computation I have to perform to ensure that *.jpg type of glob will result into Argument list too long error ?
Please note, this isn't a duplicate of What defines the maximum size of single command argument. I know about getconf ARG_MAX and ulimit -s values, that's not my question. I need to know how to generate enough arguments in size that will be above the limit. In other words, I need to find a way to get the error, not avoid it.
getconf ARG_MAXfor you?2097152. And I'm on Linux, btwxargs?Argument list too longerror. So far I've figured outulimit -sgives stack space, ARG_MAX is subset to that. I see so far thatgetconf ARG_MAXgives basically 2M by default for argument size, 8M for stack space. So basically all I need to know is how to create enough filenames to go beyond 2M limit, so that when I do*.jpgin any command that involvesexec()family of function would throw that error.