home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 6.1 What Environment Variables Are Good For Chapter 6
Shell and Environment Variables
Next: 6.3 Predefined Environment Variables
 

6.2 Parent-Child Relationships

No, this is not about the pop psychology of computing. It's just a quick reminder of one important point.

In the environment variable overview ( 6.1 ) 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 ( 38.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.)

- ML


Previous: 6.1 What Environment Variables Are Good For UNIX Power Tools Next: 6.3 Predefined Environment Variables
6.1 What Environment Variables Are Good For Book Index 6.3 Predefined Environment Variables

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru