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 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.
The following is a short list of commonly used environment variables.
For C-Shell users, the syntax is:
setenv EDITOR /bin/vi
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'
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)).
Individual locale-specific functions can be affected independently using the following optional LC_ environment variables:
(You may also have:
std offset [ dst [ offset ];[ start [ /time ], end [ /time ]]]
which is the XENIX format. Note that this format is not POSIX compatible.)
std, the standard local time zone abbreviation (1-9 characters), and offset, the difference between the local time and GMT, are the only mandatory fields.
offset should be specified as:
[ + | - ] hh [ :mm [ :ss ]]
where hh is hours (0-24), mm is minutes (0-59), and ss is seconds (0-59). Only the hours field is mandatory. If offset is preceded by a minus (-), it is east of the Prime Meridian, otherwise it is assumed to be west (this can be specified with an optional plus (+)).
dst is a 1-9 character abbreviation for the local summertime timezone. If dst is not specified, the system will not be aware of summertime; it will always be on standard time.
The offset after dst is the difference between local
standard time and local summertime.
If you do not specify an offset, it is assumed to be one hour.
(This is usually what you want.)
Everything following the second offset is the rule for when to change
from standard to summertime.
start/time is when the change to summertime occurs;
end/time is when the time changes back.
(Note that, for systems in the Southern Hemisphere,
start/time
does not have to come earlier in the year than end/time.)
start and end describe the day, while time specifies the time. time is specified in the same way as offset (see above), but the leading ``+'' or ``-'' is not valid. If time is not specified, it is assumed to be 02:00:00 (2 A.M.).
start and end can be specified in any of the following ways:
If you specify the comma starting off the summertime rule, it is advisable to specify the rest of the rule.
A sample TZ for Eastern Standard Time, EST, might look like this:
EST5:00:00EDT4:00:00,M4.1.0/2:00:00,M10.5.0/2:00:00.We start off with ``EST5:00'': this names our time zone and defines it as five hours west of Greenwich Mean Time. Summertime in this locale is called EDT (Eastern Daylight Time), and is four hours ahead of GMT. Summertime starts on a Sunday in the first week in April at 2 A.M., and standard time resumes on the last Sunday in October at 2 A.M.
Refer to the tz(M) and timezone(F) manual pages for more information on TZ.
ISO/IEC 99451:1990, Information technology Portable Operating System Interface (POSIX) Part 1: System Application Program Interface (API) [C Language] (IEEE Std 1003.11990);
NIST FIPS 1512;
AT&T SVID Issue 2.