[sf-lug] printenv "vs." set [was: Re: shell, man(1) [was: ...

Michael Paoli Michael.Paoli at cal.berkeley.edu
Mon Aug 22 23:32:38 PDT 2016


> From: "Daniel Gimpelevich" <daniel at gimpelevich.san-francisco.ca.us>
> Subject: Re: [sf-lug] printenv "vs." set [was: Re: shell, man(1) [was: ...
> Date: Sun, 21 Aug 2016 15:59:07 -0700

> On Sun, 2016-08-21 at 15:55 -0700, Alex Kleider wrote:
>> It seems that no variable (shell or environment) can exist except in
>> the
>> context of the shell.  So does that make them all shell variables?
>
> Variables set from a shell are shell variables. Those that are exported
> are environment variables in processes that inherit them.

Almost.

Shell can set environment variables - e.g. if it's already an
environment variable, or the shell makes it so.
Shell can also set environment variable that's not in shell's environment
and even without use of export,
e.g.:
$ echo $FOO

$ FOO=FOO env | grep '^FOO='
FOO=FOO
$ echo $FOO

$





More information about the sf-lug mailing list