DESCRIPTION The variable environ points to an array of
pointers to strings called the "environment". The
last pointer in this array has the value NULL. (This
variable must be declared in the user program, but is
declared in the header file <unistd.h> in case the
header files came from libc4 or libc5, and in case they came
from glibc and _GNU_SOURCE was defined.) This array of
strings is made available to the process by the exec(3) call
that started the process.

By convention the strings in environ have the form
"name=value". Com- mon examples are:

USER The name of the logged-in user (used by some
BSD-derived pro- grams).

LOGNAME The name of the logged-in user (used by some
System-V derived programs).

HOME A users login directory, set by login(1) from the
password file passwd(5).

LANG The name of a locale to use for locale categories
when not over- ridden by LC_ALL or more specific environment
variables like LC_COLLATE, LC_CTYPE, LC_MESSAGES,
LC_MONETARY, LC_NUMERIC, LC_TIME, cf. locale(5).

PATH The sequence of directory prefixes that sh(1) and
many other programs apply in searching for a file known by
an incomplete pathname. The prefixes are separated by
’:’. (Similarly one has CDPATH used by some
shells to find the target of a change directory command,
MANPATH used by man(1) to find manual pages, etc.)

PWD The current working directory. Set by some
shells.

SHELL The pathname of the users login shell.

TERM The terminal type for which output is to be
prepared.

PAGER The users preferred utility to display text
files.

EDITOR/VISUAL The users preferred utility to edit text
files.

Further names may be placed in the environment by the
export command and "name=value" in sh(1), or by
the setenv command if you use csh(1). Arguments may also be
placed in the environment at the point of an exec(3). A C
program can manipulate its environment using the func- tions
getenv(3), putenv(3), setenv(3), and unsetenv(3).

Note that the behavior of many programs and library
routines is influ- enced by the presence or value of certain
environment variables. A random collection:

BUGS Clearly there is a security risk here. Many a
system command has been tricked into mischief by a user who
specified unusual values for IFS or LD_LIBRARY_PATH.

There is also the risk of name space pollution. Programs
like make and autoconf allow overriding of default utility
names from the environment with similarly named variables in
all caps. Thus one uses CC to select the desired C compiler
(and similarly MAKE, AR, AS, FC, LD, LEX, RM, YACC, etc.).
However, in some traditional uses such an environment
variable gives options for the program instead of a
pathname. Thus, one has MORE, LESS, and GZIP. Such usage is
considered mistaken, and to be avoided in new programs. The
authors of gzip should consider renaming their option to
GZIP_OPT.