An array of strings, called the environment, is made available when a process begins. By convention, these strings have the form 'name=value'.
Names may be placed in the environment by the setenv command in case of the tcsh or by the export command in the bash shell. Refer to the section on SHELL Commands.
The following names are used by various commands :
PATH | the sequence of directory prefixes that the shell applies in |
searching for a file known by an incomplete pathname. The prefixes | |
are separated by a colon (:). The login command | |
sets PATH= :/usr/ucb:/bin:/usr/bin, unless modified by | |
an export PATH command in the .bashrc file of the user. | |
HOME | the user's login directory, set by login from the password |
file passwd. | |
TERM | the kind of terminal for which output is prepared. |
SHELL | the file name of the user's login shell. |
USER | the login name of the user. |
EXINIT | the starting list of commands read by the text editors - |
edit and vi. | |
PRINTER | the name of the default printer to be used by lpr. |
The usual way to set these environment variables in bash is by:
% export env-var-name=<new value consistent with type>
For example
% export PRINTER=elprt3
You can see the current (or default, at the time of login) values of the
environment variables by typing, for example:
% echo $PATH
This will show the current value of PATH.
As mentioned before, the environment variables are usually assigned values in the .bash_profile and .bashrc files, so that they are assigned once at login time or every time the shell is invoked.