Path: utzoo!attcan!utgpu!watmath!iuvax!uxc.cso.uiuc.edu!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Export Message-ID: <18793@mimsy.UUCP> Date: 28 Jul 89 11:20:38 GMT References: <29882@cci632.UUCP> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 In article <29882@cci632.UUCP> tvf@cci632.UUCP (Tom Frauenhofer) writes: >How does the shell mechanism to export a variable work? Are there two >environment lists, one public, one private, that a given process uses? The Bourne shell (sh), upon startup, copies its environment to an internal table. It also copies it to another table of shell variables. The shell variables are all marked `not exported'. The `export' built-in looks up the name(s) to be exported in the shell variable table, and sets the `to be exported' flag. The `name=value' code checks the `exported' flag, and if set, copies the new value into the table of environment variables. Thus, inside sh, there are three tables: - the initial environment (on the stack above main()'s frame) - the environment for new processes - all shell variables (Some of the storage for the strings is shared.) Most processes have only the first. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris