Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Environment Variables

Jim Dennis
Jim Dennis
13,075 Points

This answer is WRONG. Environment variables are passed to children by default; shell variables are not.

The question fails to make the distinction between shell variables and environment variables. The export shell command moves a key/value pair from the local variable heap to the environment. The environment is a portion of memory which is preserved (not over-written, nor discarded) during an (normal) execve() system call. Thus its contents are "inherited" by child processes.

In practice (through the "copy on write" semantics underlying the memory management for almost all Unix operating systems) this means that the child gets a "copy" of the environment.

That question should be fixed.