[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is a 'path'?

* Ben Hartshorne (debian_user@green.hartshorne.net) [021204 11:48]:
> Does the shell keep separate lists of varibles it knows about and
> variables it passes on to subshells?  why?

Something the other replies have not quite hit directly is that the
environment is a concept greater than the shell.  Every process is
executed in some environment, usually one inherited from its parent
process.  The shell doesn't keep track of variables which get copied to
the subshells; it's that when it makes the exec system call, the child
process gets a copy of its environment.  'export' is a bash builtin to
copy a shell variable into the shell's environment.

To see a little bit more about what the environment is and how it's
passed to children, and specifically how the PATH environment variable
is used, see exec(3).

good times,
"Those who desire to give up freedom in order to gain security will not have,
nor do they deserve, either one."  --President Thomas Jefferson.

Attachment: pgpxJC2Q_S2bO.pgp
Description: PGP signature

Reply to: