ENVIRON(M) XENIX System V ENVIRON(M)
Name
environ - User environment.
Description
The user environment is a collection of information about a
user, such as login directory, mailbox, and terminal type.
The environment is stored in special ``environment
variables,'' which can be assigned character values, such as
names of files, directories, and terminals. These variables
are automatically made available to programs and commands
invoked by the user. The commands can then use the values
to access the user's files and terminal.
The following is a short list of commonly used environment
variables.
PATH Defines the search path for the directories
containing commands. The system searches these
directories whenever a user types a command
without giving a full pathname. The search path
is one or more directory names separated by
colons (:). Initially, PATH is set to
:/bin:/usr/bin.
HOME Names the user's login directory. Initially,
HOME is set to the login directory given in the
user's passwd file entry.
EDITOR Used to set the editor. The default editor is
ed(C). Using vi as an example, for Bourne Shell
users, the syntax is:
EDITOR = /bin/vi
For C-Shell users, the syntax is:
setenv EDITOR /bin/vi
EXINIT Used to set vi options and define vi
abbreviations and mappings. For Bourne Shell
users, the syntax is:
EXINIT = 'set options'
For C-Shell users, the syntax is:
setenv EXINIT 'set options'
For example, a C-Shell user might place the
following command in $HOME/.cshrc:
setenv EXINIT 'set wm=24 | map g 1G'
Page 1 (printed 2/7/91)
ENVIRON(M) XENIX System V ENVIRON(M)
This would automatically set vi's wrapmargin
option to 24 and would define the ``g'' key to
move to the top of the file (just as ``G'' moves
to the bottom of the file).
You can set more than one option with the same
set command. If you define abbreviations or
mappings with this environment variable, you
must separate the abbr and map commands from the
set command and from each other with a bar (|).
The function of the bar is similar to that of
the semicolon that separates commands on a shell
command line.
If you are defining many customizations, you
might prefer to use the .exrc file, where each
command can be listed one per line (see vi(C)).
TERM Defines the type of terminal being used. This
information is used by commands such as more(C)
which rely on information about the capabilities
of the user's terminal. The variable may be set
to any valid terminal name (see terminals(M))
directly or by using the tset(C) command.
TZ Defines time zone information. This information
is used by date(C) to display the appropriate
time. The variable may have any value of the
form:
xxxnzzzs; start/time, end/time
where xxx is standard local time zone
abbreviation (1-9 characters), n is the standard
time zone difference from GMT, and may be given
as hh:mm:ss (hours:minutes:seconds), zzz is the
summertime local time zone abbreviation of 1-9
characters (if any), s is the summertime time
zone difference from GMT, and may be given as
hh:mm:ss (hours:minutes:seconds), start and end
specify the day to begin and end summertime
based on one of four rules, and time is the time
of day the change to or from summertime occurs.
The rules for specifying start and end are:
Jn 1 based Julian day n
n 0 based Julian day n
Wn.d nth day of week d
Mm.n.d nth day of week d in month m
For example:
Page 2 (printed 2/7/91)
ENVIRON(M) XENIX System V ENVIRON(M)
EST5:00:00EDT4:00:00;M4.1.0/2:00:00,M10.5.0/2:00:00.
Refer to the tz(M) manual page for more on TZ.
HZ Defines, with a numerical value, the number of
clock interrupts per second. The value of this
variable is dependent on the hardware, and
configured in the file etc/default/login. If HZ
is not defined, programs which depend on this
hertz value, such as prof(CP) and times(S), will
not run.
LANG Represents the international locale in the
format language_territory.codeset. This is used
by setlocale(S) to establish the default locale
on program startup.
Individual locale-specific functions can be affected
independently using the following optional environment
variables:
LC_CTYPE Locale affecting character classification
routines (ctype(S)).
LC_NUMERIC Locale affecting numeric formatting.
LC_TIME Locale affecting time and date format.
LC_COLLATE Locale affecting collation/sorting sequence.
LC_MESSAGES Locale affecting message language.
LC_MONETARY Locale affecting currency formatting.
The environment can be changed by assigning a new value to a
variable. An assignment has the form:
name=value
For example, the assignment:
TERM=h29
sets the TERM variable to the value ``h29''. The new value
can be ``exported'' to each subsequent invocation of a shell
by exporting the variable with the export command (see
sh(C)) or by using the env(C) command.
You may also add variables to the environment, but you must
be sure that the new names do not conflict with exported
shell variables such as MAIL, PS1, PS2, and IFS. Placing
assignments in the .profile file is a useful way to change
Page 3 (printed 2/7/91)
ENVIRON(M) XENIX System V ENVIRON(M)
the environment automatically before a session begins.
Note that the environment is made available to all programs
as an array of strings. Each string has the form:
name=value
where the name is the name of an exported variable and the
value is the variable's current value. For programs started
with a exec(S) call, the environment is available through
the external pointer environ. For other programs,
individual variables in environment are available through
getenv(S) calls.
See Also
env(C), exec(S), getenv(S)setlocale(S), locale(M),
login(M), profile(M), sh(C)
Page 4 (printed 2/7/91)