environment
Purpose
Describes the user environment.
Synopsis
Basic Environment
HOME=path name of home directory
PATH=directory search sequence
TERM=terminal type
TZ=time zone information
International Character Support Environment
NLFILE=path name of environment file
NLCTAB=path name of collating tables
NLLANG=language name
NLCURSYM=currency symbol
NLNUMSEP=triad and decimal separators
NLLDAY=long day names
NLLMONTH=long month names
NLSDAY=short day names
NLSMONTH=short month names
NLTMISC=miscellaneous time strings
NLTSTRS=relative time names
NLTUNITS=time unit names
NLDATE=short date format
NLLDATE=long date format
NLTIME=time format
Description
When a new process begins, the exec system call makes an
array of strings available that have the form name=value.
This array of strings is called the environment. Each
name defined by one of the strings is called an environ-
ment variable or shell variable.
When using the sh command interpreter, additional names
can be placed in the environment with the export or env
command, or by adding a name=value prefix to any other
command. See the sh command in AIX Operating System Com-
mands Reference for more information about setting envi-
ronment variables with shell commands.
Within a program, the getenv subroutine can be used to
search the environment for the value of a given variable.
The exec system call allows the entire environment to be
set at one time, usually for a newly started child
process.
When creating new environment variables, ensure that
their names do not conflict with those of standard vari-
ables used by the shell and other programs, such as MAIL,
PS1, PS2, and IFS.
THE BASIC ENVIRONMENT
When you log in, a number of environment variables are
automatically set by the system before running your login
profile, .profile. These variables make up the basic
environment:
HOME The full path name of the user's login or home
directory. The login program sets this to the
name specified in the /etc/passwd file.
PATH The sequence of directories that commands such as
sh, time, nice, and nohup search when looking for
a command whose path name is incomplete. The
directory names are separated by colons. PATH is
set by the system login profile, /etc/profile.
TERM The type of terminal for which output is to be
prepared. Commands such as mm and tplot use this
information to manipulate special capabilities, if
any, of that terminal. The curses, extended
curses, and terminfo subroutines also use the
value of TERM. For asynchronous terminals, TERM
is set by the getty command to a value defined in
/etc/ports. For the RT PC console, TERM is set
using the termdef subroutine.
TZ Time zone information. TZ is set in the system
login profile, /etc/profile.
The fields of TZ are separated by colons. The
first field has three subfields, lcl, n, and dst.
If they are not supplied, the defaults for the
U.S.A. Eastern Standard (and Daylight Savings)
Time Zone are used.
The additional fields of TZ specify when daylight
savings time begins and ends. If these fields are
not supplied, U.S.A. rules for daylight savings
time apply. Daylight savings time specifications
apply to all years, and may require adjustment
from year to year in locations where the start of
daylight savings time varies.
TZ is represented in the format:
lclndst[:bgn:end:chgwd:chghr:chgamt|
where
lcl Is the standard local time zone abbrevi-
ation. This name must be nine bytes or
fewer, and cannot contain periods,
colons, or hyphens. To be compatible
with other operating systems, this name
should be three bytes.
n Is the difference in local time from GMT
in hours (a number from -12 to 12),
optionally followed by a period and a
number of minutes. Negative differences
are for locations east of Greenwich. To
be compatible with other operating
systems, this difference should not
contain minutes.
dst Is the abbreviation for the local day-
light savings time zone, if any. This
name must be nine bytes or fewer, and
cannot contain periods, colons, or
hyphens. To be compatible with other
operating systems, this name should be
three bytes long.
bgn Is the beginning day of daylight savings
time, if any. This number is the Julian
value, or number of days into the year.
The value is specified for a non-leap
year and adjusted as necessary for leap
years.
end Is the ending day (Julian) of daylight
savings time, if any. If the value of
end is smaller than the value of bgn,
daylight savings time crosses the new
year, as is the practice in the Southern
Hemisphere.
chgwd Is the weekday of the change to daylight
savings time, if any. Values range from
1 to 7, with 1 representing Monday and 7
representing Sunday. This value speci-
fies that daylight savings time begins
and ends on the first named weekday
before the Julian dates specified by bgn
and end. (For example, you could specify
the last Saturday in October.) If the
value of this field is 0 or not entered,
the exact Julian date given is used (cor-
rected for leap year where necessary).
chghr Is the hour of the change to daylight
savings time, if any (number of elapsed
hours in the day, optionally followed by
a period and a number of minutes).
chgamt Is the amount of the change to daylight
savings time. This value is specified by
an optionally signed number of minutes,
optionally followed by a period and a
number of minutes. That is, [-|hh[.mm|.
For example, a TZ string for Lord Howe Island,
Australia in 1985-86 might be:
AusLHIst-10.30AusLHIdt:300:60::2:0.30
International Character Support Environment
A special set of environment variables defines the inter-
national character support configuration. These environ-
ment variables locate configuration information and
tailor input and output forms of dates, times, and mone-
tary sums according to "national" or local requirements.
If an environment variable value for international char-
acter support contains blanks, the value appear in quotes
and blanks cannot separate the equals sign from the vari-
able name or the value.
Environment variables for international character support
are specified in the process environment using ordinary
shell environment variables, or in the text file whose
path name is specified by the shell environment variable
NLFILE. Values specified in the process environment take
precedence over values specified in NLFILE. If a given
environment variable is not set either in the process
environment or in NLFILE, or if a specified value is the
null string, a default value is used.
The NLgetenv subroutine provides a program with a method
to retrieve a value associated with an international
character support environment variable.
Environment variables that establish the local environ-
ment vocabulary specification consist of a sequence of
strings separated by colons. The set of conventions
being used is identified by the value of NLLANG. Each
string must be a translation of the U.S. English name or
symbol used in the defaults, in exactly the same order.
The NLDATE, NLLDATE, and NLTIME variables are format
strings that can be specified as simple format strings or
as NLstrtime format strings. These strings are arbi-
trary, but cannot begin with an * (asterisk). When the
patterns listed in the following table appear in a simple
format string, NLgetenv substitutes the appropriate part
of the date or time.
Pattern Meaning Replacement
DD Numeric day of the %d
month
MM Numeric month %m
YY Numeric year (two %y
digits)
Pattern Meaning Replacement
YYYY Numeric year (four %Y
digits)
mon Month specified by %h
NLSMONTH
month Month specified by %lh
NLSMONTH
hh Numeric hour %H
mm Numeric minutes %M
ss Numeric seconds %S
aa Numeric AM/PM indi- %p
cator
Characters that are not part of replacement patterns are
not translated. These are some examples of simple format
strings:
mon DD, YYYY hh.mm
MM/DD/YY hh:mm:ss
DD.MM.YY hh:mm aa
YYYY-MM-DD
DD month YY
Format strings of the style of NLstrtime follow the same
form as the format parameter of NLstrtime, except that
the string must be preceded by an asterisk and it cannot
contain the formats %D, %sD, %lD, %T, %sT, or %r. The
asterisk is not translated and does not become part of
the result.
The environment variables are described as follows:
NLCTAB The path name of the file containing tables
that define the current collating sequence, as
produced by the ctab command. The default
path name is:
/etc/nls/ctab/default
NLCURSYM The currency symbol name and placement. The
default value is:
:$:L:
NLDATE The environment format string specifying the
short form of the date. This format is used
by NLstrtime when the format %D is encount-
ered. The default is:
MM/DD/YY
NLFILE The path name of a file containing other envi-
ronment variable definitions for international
character support. NLFILE cannot be defined
within a file that is identified by another
NLFILE definition. There is no default path
name.
NLLANG The environment language label for the set of
variables and environment format strings used
for language conventions. The default value
is:
u.s.english
NLLDATE The environment format string specifying the
long form of the date. This form is used by
NLstrtime when the formats %lD or %sD are
encountered. The default long date format
string is:
mon DD, YYYY
NLLDAY The full (long) names for the days of the
week. The default value is:
Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday
NLLMONTH The full (long) names for the months of the
year. The default value is:
January:February:March:April:May:June:July:\
August:September:October:November:December
NLNUMSEP The numeric triad and decimal separators. The
first of the two separators is the triad sepa-
rator, which is used to separate groups of
three digits in decimal values. The default
value for NLNUMSEP is:
:,:.:
NLSDAY The short names of the days of the week.
Names should be the same length, and of 5 or
fewer characters. The default short name
string is:
Sun:Mon:Tue:Wed:Thu:Fri:Sat
NLSMONTH The short names of the months of the year.
Names should be the same length, and of 5 or
fewer characters. The default value is:
Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec
NLTIME The environment format string specifying the
format of the time, that is used by NLstrtime
when the formats %T, %sT, or %r are encount-
ered. The default time format string is:
hh:mm:ss
NLTMISC Miscellaneous strings needed for input and
output of date and time specifications. The
default miscellaneous string value is:
at:each:every:on:through:am:pm
NLTSTRS The relative or informal names needed for
input of date and time specifications to the
remind and at commands (see the remind and at
commands in AIX Operating System Commands Ref-
erence). The default informal time string
value is:
now:yesterday:tomorrow:noon:midnight:next:weekdays:weekend
NLTUNITS The singular and plural forms for all names of
units of time, used for input of date specifi-
cations to the at command. The default string
value for units of time is:
"
minute:minutes:hour:hours:day:days:week:weeks:month:months:year:years
"
Files
/etc/environment Sets the basic environment for
all processes.
/etc/profile Allows variables to be added to
the environment by the shell.
$HOME/.profile Sets the environment for a spe-
cific user's needs.
/etc/nls/ctab/default Sets the international character
support environment.
Related Information
In this book: "exec: execl, execv, execle, execve,
execlp, execvp," "getenv, NLgetenv," "NLstrtime,"
"NLtmtime," "termdef," "passwd," "profile," and "TERM."
The ctab, env, export, login, and sh commands in AIX
Operating System Commands Reference.
"Overview of International Character Support" in Managing
the AIX Operating System.