[PLUG] avoiding "Argument list too long" error.

Auke Kok sofar at foo-projects.org
Mon Oct 9 22:04:57 UTC 2006


Brent Rieck wrote:
> Brent Rieck wrote:
>> Yes, and no it doesn't work, it really appears to be a bash issue:
> 
> Feh.  Google tells me that it's actually a kernel issue and to make 
> things work as intended I must recompile my kernel.  What year is this 
> again?

I'm unsure why you would consider it an 'issue'. Arguments passed to a program are 
stored in the kernel so limiting them to some sane number sounds reasonable, if only to 
reduce the chance of something trying to pass 10 million arguments of 65k, quickly 
consuming more than half a gig of memory.

there are plenty of ways around this limit too, even much more efficient in doing large 
numbers of arguments:

blunt bash-only compatible code below:

while read FOO; do
	something $FOO
done < <(ls)


or just use `find . -type f -exec grep "bar" {} \;`

Cheers,

Auke



More information about the PLUG mailing list