SUMMARY: Limits for environment variables

From: Ross Helfand (rhelfand@census.gov)
Date: Tue Mar 17 1998 - 08:54:09 CST


Original question:

>Hello Sun Managers!
>
>I'm a relative UNIX newbie, but I've looked through man pages and
>archives for the past few hours with no luck.
>
>What is the maximum size of the value of an environment variable? Can
>this value be modified? I'm also curious about the size limitations of

>the variable name and the total environment.
>
>Any help would be appreciated. Thanks!
>Ross Helfand
>Census Bureau

Thanks (in no particular order) to:

Rich Snyder <rsnyder@eos.EAST.HITC.COM>
Jason Marshall <jasonm@vsl.com>
Russ Poffenberger <poffen@San-Jose.ate.slb.com>
Janet Hoo <Janet.Hoo@Ebay.Sun.COM>
Casper Dik <casper@holland.Sun.COM>
Kevin Sheehan <Kevin.Sheehan@uniq.com.au>

Several people pointed out that the 'csh' man page states that "... A
variable name consists of up to 20 letters and digits .... ," although I
can't find a reference to size in the 'sh' or 'ksh' man pages.

The maximum size for the VALUE of the environment variable depends on
your shell. It's about 1k in csh, and beyond my reasonable limits for
sh. Jason Marshall was kind enough to write a couple of quick looping
shell scripts to verify this information. The csh script stopped right
around 1k, and the sh script was up in the megabyte range before he gave
up.

Casper wrote "... that the Solaris 2.x/SunOS 4.x limit of the sum of all
environment variables and command line arguments is one megabyte. That
limit cannot be changed."

I was pointed to the execv{2} man page for information also, but I think
that's above my current level! ;)

Thanks a lot to everyone who replied!
Ross



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:33 CDT