No, this is not about the psychology of computing. It's just a reminder of one important point.
In the environment variable overview (Section 35.3) we said that each process gets its own copy of its parent's environment variables. We chose those words carefully, and if you think about them, you won't make one common mistake.
Sooner or later, almost everyone writes a shell script that gathers some information, sets a few environment variables, and quits. The writer then wonders why there's no trace of the "new" environment variables to be found. The problem is simple. A Unix process (Section 24.3) cannot change its parent's environment; a Unix process gets its own copy of the parent's environment, and any changes it makes it keeps to itself. A process can make changes and pass them to its children, but there's no way of going in reverse.
(You can't teach an old dog new tricks.)
[This is important in window systems, too. Environment variables set in one window (more exactly, in one process) probably won't affect any process running in any other window. To affect all windows, set the environment variable before you start the window system. For instance, if you log in and then type startx from a shell prompt to start X, you can set environment variables from that prompt or from that shell's setup files (Section 3.3). -- JP]
-- ML
Copyright © 2003 O'Reilly & Associates. All rights reserved.