ENVIRON(7) | Miscellaneous Information Manual | ENVIRON(7) |
environ
— user
environment
extern char **environ;
An array of strings called the environment is made available by execve(2) when a process begins. By convention these strings have the form “name=value”. The following names are used by various commands:
BLOCKSIZE
COLUMNS
EDITOR
EXINIT
HOME
LANG
LC_*
variables are set.LC_ALL
LC_COLLATE
,
LC_CTYPE
, LC_MESSAGES
,
LC_MONETARY
, LC_NUMERIC
,
LC_TIME
and LANG
.LC_COLLATE
LC_CTYPE
LC_MESSAGES
LC_MONETARY
LC_NUMERIC
LC_TIME
MAIL
NLSPATH
LC_MESSAGES
. See
catopen(3).PAGER
PATH
PATH
is set to ``/usr/bin:/bin''
initially by login(1).PRINTER
PWD
SHELL
TERM
TERMCAP
TERM
, or, if
it begins with a '/', the name of the termcap file. See
TERMPATH
below, and
termcap(5).TERMPATH
TERMPATH
is equivalent to a
TERMPATH
of
“$HOME/.termcap:/etc/termcap”.
TERMPATH
is ignored if
TERMCAP
contains a full pathname.TMPDIR
TZ
USER
Further names may be placed in the environment by the
export
command and name=value
arguments in sh(1), or by the
setenv
command if you use
csh(1). It is unwise to change certain
sh(1) variables that are frequently
exported by .profile files, such as
MAIL
, PS1
,
PS2
, and IFS
, unless you
know what you are doing.
The current environment variables can be printed with
env(1),
set(1) or
printenv(1) in
sh(1) and
env(1),
printenv(1) or the
printenv
built-in command in
csh(1).
Programs can query and modify the environment, using the environment routines getenv(3), putenv(3), setenv(3) and unsetenv(3). Direct access can be made through the global variable environ, though it is recommended that changes to the enviroment still be made through the environment routines.
Shared libraries and bundles don't have direct
access to environ, which is only available to the
loader ld(1) when a complete program is
being linked. The environment routines can still be used, but if direct
access to environ is needed, the
_NSGetEnviron
()
routine, defined in
<crt_externs.h>
, can be used
to retrieve the address of environ at runtime.
cd(1), csh(1), env(1), ex(1), login(1), printenv(1), sh(1), execve(2), execle(3), getenv(3), putenv(3), setenv(3), unsetenv(3), setlocale(3), system(3), termcap(3), termcap(5)
The environ
manual page appeared in
4.2BSD.
April 12, 2003 | macOS 15.2 |