December 1994
Intermediate to advanced
606 pages
16h 7m
English
The global array env is pre-initialized so that each element corresponds to an environment variable. For example, the path is a list of directories to search for executable programs. From the shell, the path is stored in the variable PATH. When using Tcl, the path is contained in env(PATH). It is manipulated just like any other variable.
tclsh>set env(PATH)/usr/local/bin:/usr/bin:/bin tclsh>set env(PATH) ".:$env(PATH)" ;# prepend current dir.:/usr/local/bin:/usr/bin:/bin
Modifications to the env array do not affect the parent environment, but new processes that are created (using exec, for instance) will inherit the current values (including any new elements that have created).
Read now
Unlock full access