On Mon, Aug 11, 2008 at 4:40 PM, Woodchuck <[EMAIL PROTECTED]> wrote:
> On Mon, 11 Aug 2008, Nick Guenther wrote:
>
>> 'export' is a command that takes a list of strings, treats them as
>> environment variables, and pushes those variables out to the world
>> outside of your current shell (that's why you have to use export in
>> .profile, because .profile gets run in its own subshell, just like
>> every script).
>
>
> A subprocess (which is what a subshell is) cannot affect its
> parent's environment (or other parts of its address space without
> special measures, not discussed here).  This is an "iron law" of
> the Unix process model.
>
> If you put lines in .profile:
>
>        ZIP="zap"
>        export ZIP
>
> and execute .profile as:
>
>        $ ./.profile
>
> then
>        $ echo $ZIP
>
> you get nothing.
>
> On the other hand
>
>        $ . ./.profile
>        $ echo $ZIP
>        zap

Oh, I didn't realize that. Thanks. That's very subtle.

-Nick
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies

Reply via email to