|
CEG 333: Introduction to UnixPrabhaker MatetiThe Environment String |
The environment is the set of string variables available
to all processes. The env command displays the
environment and the set command manipulates it.
Since all programs can access the environment string, it's
frequently used as a way to supply options to commands without
repeating them every time the command is invoked. (ls
reads LS_OPTIONS, for example).
Other examples of values commonly stored in the environment are:
HISTSIZE: the number of items to store in
~/.bash_history (or HISTFILE)PATH: the path searched for commands by the shellPWD: the current working directoryPS1: the format of the command promptDISPLAY: the computer on which to show X
programsIt is a Unix convention that all global environment variable names be upper-case.
In bash, environment variables may be manipulated just like any
other shell variable, using $, =, and so
forth. For example, PATH=$PATH:~/bin appends the
user's own bin directory to the path.