NetBSD-Users archive

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

Re: Silly shell question



On 2016-03-22 22:07, Swift Griggs wrote:
On Tue, 22 Mar 2016, Johnny Billquist wrote:
Only environment variables are propagated to child processes.

Thanks for the info, but do you happen to know what the actual mechanism
that the child processes is able to "import" the exported variable ?
Ie.. is it some special OS glue/magic, or is it just straight getenv()
calls by the client shell/app ? I don't see anything magical in the man
page for getenv() that would distinguish an exported versus non-exported
variable.

A child process gets the environment as a part of the image activation. It's actually provided as an argument to each program, except most programs do not care to pick it up.

getenv() also just access these environment variables that the system provided at image activation.

Shell local variables are not accessible to anything outside the shell.

	Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index