When a process begins execution, exec
routines make available an array of strings called the
environment [see
exec(2)].
By convention, these strings have the form variable=value,
for example, PATH=/sbin:/usr/sbin.
These environment variables provide a way to make
information about a program's environment available to programs.
The environment variables described below can be used by
applications and are expected to be set in the target runtime environment.
Further names may be placed in the environment by the
export
command and
name=value
arguments in
sh(1),
or by
exec(2).
It is unwise to conflict with certain shell variables that are frequently
exported by .profile files:
MAIL, PS1, PS2, IFS [see
profile(4)].
HOME
The name of the user's login directory, set by
login(1)
from the password file [see
passwd(4)].
LANG
The program's locale.
Locales consist of files that describe the conventions
appropriate to some nationality, culture, and language.
The $HOME/.env file usually sets the LANG variable.
This file is set by the Account Manager and overrides the system
defaults. If the $HOME/.env file is not present on the system,
/etc/default/locale is used.
Generally, users determine which files are selected by manipulating
the environment variables described below.
For background, see
setlocale(3C).
Locales are partitioned into categories LC_COLLATE,
LC_CTYPE, LC_MESSAGES, LC_MONETARY,
LC_NUMERIC,
and LC_TIME (see below for what the categories control).
LC_ALL overrides all these categories.
Each category has a corresponding environment variable that
the user can set to specify that category's locale:
LC_CTYPE=fr[ancais]
When the LC_ALL variable is set, it overrides all
other LC_* variables, as well as the LANG setting.
When LC_ALL is not set, the LANG environment variable is
searched if the environment variable for a category is unset or empty:
LANG=fr
LC_COLLATE=de[utsche]
sets all the categories but LC_COLLATE to French.
If LANG is unset or empty, the default C locale is used.
LC_ALL
specifies the name of the locale to be used.
This value overrides values for locale categories specified by the
LANG setting or any other LC_ category environment
variable.
LC_COLLATE
specifies the collation order used.
The information for this category is stored in a database
created by the
colltbl(1M)
command.
This environment variable affects
sort(1),
strcoll(3C),
and
strxfrm(3C).
LC_CTYPE
specifies character classification, character conversion,
and widths of multibyte characters.
The information for this category is stored in a database created by the
chrtbl(1M)
or
wchrtbl(1M)
commands.
The default C locale uses the 7-bit US ASCII character set.
This environment variable affects many commands and functions, among them,
cat(1),
ed(1),
ls(1),
vi(1),
ctype(3C),
and
mbchar(3C).
LC_MESSAGES
specifies the message database used.
A command or application may have French and German message databases, for
example.
Message databases are created by the
mkmsgs(1)
or
gencat(1)
commands.
This environment variable affects
gettxt(1),
srchtxt(1),
catgets(3C),
and
gettxt(3C),
and every command that generates
locale-specific output messages.
LC_MONETARY
specifies the monetary symbols and delimiters used.
The information for this category is stored in a database created
by the
montbl(1M)
command.
This environment variable affects
localeconv(3C).
LC_NUMERIC
specifies the decimal and thousands delimiters.
The information for this category is stored in a database
created by the
chrtbl(1M)
or
wchrtbl(1M)
commands.
The default C locale uses a period (.) as the
decimal delimiter and no thousands delimiter.
This environment variable affects
localeconv(3C),
printf
[see
fprintf(3S)],
scanf [see
fscanf(3S)],
and
strtod(3C).
LC_TIME
specifies date and time formats.
The information for this category is stored in a database specified in
strftime(4).
The default C locale uses US date and time formats.
This environment variable affects many commands and functions, among them,
at(1),
calendar(1),
date(1),
getdate(3C),
and
strftime(3C).
MSGVERB
Controls which standard format message components
fmtmsg selects when messages are displayed to
stderr [see
fmtmsg(1)
and
fmtmsg(3C)].
SEV_LEVEL
Defines severity levels and associates and prints strings with them in
standard format error messages [see
addseverity(3C),
fmtmsg(1),
and
fmtmsg(3C)].
NETPATH
A colon-separated list of network identifiers.
A network identifier is a character string used by the Network Selection
component of the system to provide application-specific default
network search paths.
A network identifier must consist of non-NULL
characters and must have a length of at least 1.
No maximum length is specified.
Network identifiers are normally chosen by the system administrator.
A network identifier is also the first field in any
/etc/netconfig file entry.
NETPATH thus provides a link into the /etc/netconfig
file and the information about a network contained in that network's entry.
/etc/netconfig is maintained by the system administrator.
The library routines described in
getnetpath(3N)
access the
NETPATH environment variable.
NLSPATH
Contains a sequence of templates which
catopen(3C)
uses when attempting to locate message catalogs.
Each template consists of a pathname containing one or more optional
substitution fields.
For example:
NLSPATH="/system/nlslib/%N.cat"
specifies that catopen should look for all message catalogs in the
directory /system/nlslib, where the catalog name should be constructed
from the name
parameter passed to catopen,
%N, with the suffix .cat.
Substitution fields consist of a % symbol, followed by a
single-letter keyword.
The following keywords are currently defined
(where locale elements are described below):
%N
The value of the name parameter passed to catopen.
%L
The value of locale.
%l
The language element from locale.
%t
The territory element from locale.
%c
The codeset element from locale.
%%
A single % character.
%A
The value of the archive portion of a
name@archive
parameter passed to catopen.
locale provides the ability to specify the user's requirements for
native language, local customs, and character set, as an ASCII string
in the form
language[_territory[.codeset]]
A user who speaks German as it is spoken in Austria and has a terminal
which operates in ISO 8859/1 codeset, would want the setting of
the locale to be
De_A.88591
An empty string is substituted if the specified value is not currently defined.
The separators ``_'' and ``.'' are not included in %t
and %c substitutions.
Templates defined in NLSPATH are separated by colons (:).
A leading colon or two adjacent colons (::) is equivalent to
specifying %N.
For example:
NLSPATH=":%N.cat:/nlslib/%L/%N.cat"
indicates to catopen that it should look for the requested message catalog
in name, name.cat, and
/nlslib/locale/name.cat.
The %A keyword is provided for compatibility with SCO OpenServer
applications that use the name@archive
form of the name argument to catopen.
If @archive is present, then a %A in
NLSPATH is replaced with the archive portion of
the name passed to catopen.
If @archive is not present,
then nothing is substitued for %A in NLSPATH.
For information on setting up a locale, see
setlocale(3C).
PATH
The sequence of directory prefixes that
sh(1),
time(1),
nice(1),
nohup(1),
and so on
apply in searching for a file known by an incomplete path name.
The prefixes are separated by colons (:).
login(1)
sets PATH=/usr/bin.
[For more detail, see
sh(1).]
SHELL
When the shell is invoked, it scans the environment for this name.
If it is found and rsh is the filename part of its value,
the shell becomes a restricted shell.
The value of this variable should be specified with an absolute pathname.
The variable is used by
make(1),
ksh(1),
sh(1),
and
vi(1),
among other commands.
TERM
The kind of terminal for which output is to be prepared.
This information is used by commands, such as
vi(1),
which may exploit special capabilities of that terminal.
TZ
Time zone information.
The contents of the environment variable named TZ are used by the
functions
ctime(3C),
localtime [see
ctime(3C)],
strftime(3C),
and
mktime(3C)
to override the default time zone.
If the first character of TZ is a colon (``:''), as in:
TZ=:name
then name is assumed to be a full or relative path to a
tic-compiled timezone description (see
tic(1M)).
If the first character of name is a slash (``/''),
then name is assumed to be a full pathname; otherwise,
the directory /usr/lib/locale/TZ/ is searched for a
file with the supplied name.
If the first character of TZ is not a colon (:),
TZ has the form:
stdoffset[dst[offset],[start[/time],end[/time]]]
std and dst
Three or more bytes that are the designation for the standard
(std) and daylight savings time (dst) time zones.
Only
std
is required, if
dst
is missing, then daylight savings time does not apply in this locale.
Upper- and lowercase letters are allowed.
Any characters except a leading colon (:), digits, a comma (,),
a minus (-), or a plus (+) are allowed.
offset
Indicates the value one must add to the local time to arrive at
Coordinated Universal Time.
The offset has the form:
hh[:mm[:ss]]
The minutes (mm) and seconds (ss) are optional.
The hour (hh) is required and may be a single digit.
The
offset
following
std
is required.
If no
offset
follows
dst,
daylight savings time is assumed to be one hour ahead of standard time.
One or more digits may be used; the value is always
interpreted as a decimal number.
The hour must be between 0 and 24, and the minutes (and seconds) if
present between 0 and 59.
Out of range values may cause unpredictable behavior.
If preceded by a ``-'', the time zone is east of the Prime Meridian;
otherwise it is west (which may be indicated by an optional
preceding ``+'' sign).
start/time,end/time
Indicates when to change to and back from daylight savings time, where
start/time
describes when the change from standard time to daylight savings time occurs, and
end/time
describes when the change back happens.
Each
time
field describes when, in current local time, the change is made.
The formats of
start
and
end
are one of the following:
Jn
The Julian day
n
(1
n
365).
Leap days are not counted.
That is, in all years, February 28 is day 59 and March 1 is day 60.
It is impossible to refer to the occasional February 29.
n
The zero-based Julian day
(0
n
365).
Leap days are counted,
and it is possible to refer to February 29.
Wn[.d]
Specifies a change to or from the alternate timezone on day d
(default of ``0'' or Sunday) of week number n, where
the first day of the year is in week 1.
Mm.n.d
The d[th] day, (0 d 6) of week
n of month m of the year
(1 n 5, 1 m 12),
where week 5 means ``the last d-day in month m''
which may occur in either the fourth or the fifth week).
Week 1 is the first week in which the
d[th]
day occurs.
Day zero is Sunday.
Implementation-specific defaults are used for
start
and
end
if these optional fields are not given.
The
time
has the same format as
offset
except that no leading sign (``-'' or ``+'') is allowed.
The default, if
time
is not given is 02:00:00.
Compatibility
Previous releases supported the use of a semicolon (``;'') as a
synonym for a comma (``,'') in TZ syntax (for XENIX system
compatibility).
This is disallowed by X/Open System Interfaces and Headers, Issue 4,
Version 2 conformance tests, and so is no longer supported.