On Tue, May 10, 2005 at 11:28:25AM -0400, Charles Shannon Hendrix wrote:
> > i think you've said this, but as a clarification, it all depends upon
> > passing parameters to an executable. for instance these have no limits:
> > echo `ls`
> > x=`ls`
> That's not true. Some (most?) shells have a maximum size for
> environment variables.
i have never hit a maximum size and i have flexed it pretty hard, but
you may be right. since i've never hit a max i assumed it was the amount
of virtual memory available to the shell.
echo `cd /; ls -R`
it'll take a while, but it'll run. likewise, the same is true for:
x=`cd /; ls -R`
/bin/echo `cd /; ls -R`
btw, i tried these commands on my system before i sent my email.
> > because they're shell builtin's. the following has a limit based on
> > the number of parameters passed in through argv and the number of bytes
> > permittable in argv:
> > /bin/echo `ls`
> No, the limit comes from the shell. argv has no byte limits, it is just
> a pointer. The system itself might have a limit, but it is usually
> quite high.
try out the attached program (apologies for it's simpleness). notice
there is no shell involved and execv() will eventually fail. on my
system that number was 32491 (roughly 2^15):
$ ./x 32491
execv: Argument list too long
mark at tux dot org
nova-instructor at tux dot org
Description: Text document
ma-linux mailing list