1environ(5) Standards, Environments, and Macros environ(5)
2
3
4
6 environ - user environment
7
9 When a process begins execution, one of the exec family of functions
10 makes available an array of strings called the environment; see
11 exec(2). By convention, these strings have the form variable=value, for
12 example, PATH=/sbin:/usr/sbin. These environmental variables provide a
13 way to make information about a program's environment available to pro‐
14 grams.
15
16
17 A name may be placed in the environment by the export command and
18 name=value arguments in sh(1), or by one of the exec functions. It is
19 unwise to conflict with certain shell variables such as MAIL, PS1, PS2,
20 and IFS that are frequently exported by .profile files; see profile(4).
21
22
23 The following environmental variables can be used by applications and
24 are expected to be set in the target run-time environment.
25
26 HOME
27
28 The name of the user's login directory, set by login(1) from the
29 password file; see passwd(4).
30
31
32 LANG
33
34 The string used to specify internationalization information that
35 allows users to work with different national conventions. The set‐
36 locale(3C) function checks the LANG environment variable when it is
37 called with "" as the locale argument. LANG is used as the default
38 locale if the corresponding environment variable for a particular
39 category is unset or null. If, however, LC_ALL is set to a valid,
40 non-empty value, its contents are used to override both the LANG
41 and the other LC_* variables. For example, when invoked as setlo‐
42 cale(LC_CTYPE, ""), setlocale() will query the LC_CTYPE environment
43 variable first to see if it is set and non-null. If LC_CTYPE is not
44 set or null, then setlocale() will check the LANG environment vari‐
45 able to see if it is set and non-null. If both LANG and LC_CTYPE
46 are unset or NULL, the default "C" locale will be used to set the
47 LC_CTYPE category.
48
49 Most commands will invoke setlocale(LC_ALL, "") prior to any other
50 processing. This allows the command to be used with different
51 national conventions by setting the appropriate environment vari‐
52 ables.
53
54 The following environment variables correspond to each category of
55 setlocale(3C):
56
57 LC_ALL
58
59 If set to a valid, non-empty string value, override the values
60 of LANG and all the other LC_*variables.
61
62
63 LC_COLLATE
64
65 This category specifies the character collation sequence being
66 used. The information corresponding to this category is stored
67 in a database created by the localedef(1) command. This
68 environment variable affects strcoll(3C) and strxfrm(3C).
69
70
71 LC_CTYPE
72
73 This category specifies character classification, character
74 conversion, and widths of multibyte characters. When LC_CTYPE
75 is set to a valid value, the calling utility can display and
76 handle text and file names containing valid characters for that
77 locale; Extended Unix Code (EUC) characters where any indi‐
78 vidual character can be 1, 2, or 3 bytes wide; and EUC charac‐
79 ters of 1, 2, or 3 column widths. The default "C" locale corre‐
80 sponds to the 7-bit ASCII character set; only characters from
81 ISO 8859-1 are valid. The information corresponding to this
82 category is stored in a database created by the localedef()
83 command. This environment variable is used by ctype(3C),
84 mblen(3C), and many commands, such as cat(1), ed(1), ls(1), and
85 vi(1).
86
87
88 LC_MESSAGES
89
90 This category specifies the language of the message database
91 being used. For example, an application may have one message
92 database with French messages, and another database with German
93 messages. Message databases are created by the mkmsgs(1) com‐
94 mand. This environment variable is used by exstr(1), gettxt(1),
95 srchtxt(1), gettxt(3C), and gettext(3C).
96
97
98 LC_MONETARY
99
100 This category specifies the monetary symbols and delimiters
101 used for a particular locale. The information corresponding to
102 this category is stored in a database created by the
103 localedef(1) command. This environment variable is used by
104 localeconv(3C).
105
106
107 LC_NUMERIC
108
109 This category specifies the decimal and thousands delimiters.
110 The information corresponding to this category is stored in a
111 database created by the localedef() command. The default C
112 locale corresponds to "." as the decimal delimiter and no thou‐
113 sands delimiter. This environment variable is used by locale‐
114 conv(3C), printf(3C), and strtod(3C).
115
116
117 LC_TIME
118
119 This category specifies date and time formats. The information
120 corresponding to this category is stored in a database speci‐
121 fied in localedef(). The default C locale corresponds to U.S.
122 date and time formats. This environment variable is used by
123 many commands and functions; for example: at(1), calendar(1),
124 date(1), strftime(3C), and getdate(3C).
125
126
127
128 MSGVERB
129
130 Controls which standard format message components fmtmsg selects
131 when messages are displayed to stderr; see fmtmsg(1) and
132 fmtmsg(3C).
133
134
135 NETPATH
136
137 A colon-separated list of network identifiers. A network identifier
138 is a character string used by the Network Selection component of
139 the system to provide application-specific default network search
140 paths. A network identifier must consist of non-null characters and
141 must have a length of at least 1. No maximum length is specified.
142 Network identifiers are normally chosen by the system administra‐
143 tor. A network identifier is also the first field in any /etc/net‐
144 config file entry. NETPATH thus provides a link into the /etc/net‐
145 config file and the information about a network contained in that
146 network's entry. /etc/netconfig is maintained by the system admin‐
147 istrator. The library routines described in getnetpath(3NSL) access
148 the NETPATH environment variable.
149
150
151 NLSPATH
152
153 Contains a sequence of templates which catopen(3C) and gettext(3C)
154 use when attempting to locate message catalogs. Each template con‐
155 sists of an optional prefix, one or more substitution fields, a
156 filename and an optional suffix. For example:
157
158 NLSPATH="/system/nlslib/%N.cat"
159
160
161 defines that catopen() should look for all message catalogs in the
162 directory /system/nlslib, where the catalog name should be con‐
163 structed from the name parameter passed to catopen(), %N, with the
164 suffix .cat.
165
166 Substitution fields consist of a % symbol, followed by a single-
167 letter keyword. The following keywords are currently defined:
168
169 %N
170
171 The value of the name parameter passed to catopen().
172
173
174 %L
175
176 The value of LANG or LC_MESSAGES.
177
178
179 %l
180
181 The language element from LANG or LC_MESSAGES.
182
183
184 %t
185
186 The territory element from LANG or LC_MESSAGES.
187
188
189 %c
190
191 The codeset element from LANG or LC_MESSAGES.
192
193
194 %%
195
196 A single % character.
197
198 An empty string is substituted if the specified value is not cur‐
199 rently defined. The separators "_" and "." are not included in %t
200 and %c substitutions.
201
202 Templates defined in NLSPATH are separated by colons (:). A leading
203 colon or two adjacent colons (::) is equivalent to specifying %N.
204 For example:
205
206 NLSPATH=":%N.cat:/nlslib/%L/%N.cat"
207
208
209 indicates to catopen() that it should look for the requested mes‐
210 sage catalog in name, name.cat and /nlslib/$LANG/name.cat. For get‐
211 text(), %N automatically maps to "messages".
212
213 If NLSPATH is unset or NULL, catopen() and gettext() call setlo‐
214 cale(3C), which checks LANG and the LC_* variables to locate the
215 message catalogs.
216
217 NLSPATH will normally be set up on a system wide basis (in
218 /etc/profile) and thus makes the location and naming conventions
219 associated with message catalogs transparent to both programs and
220 users.
221
222
223 PATH
224
225 The sequence of directory prefixes that sh(1), time(1), nice(1),
226 nohup(1), and other utilities apply in searching for a file known
227 by an incomplete path name. The prefixes are separated by colons
228 (:). login(1) sets PATH=/usr/bin. For more detail, see sh(1).
229
230
231 SEV_LEVEL
232
233 Define severity levels and associate and print strings with them in
234 standard format error messages; see addseverity(3C), fmtmsg(1),
235 and fmtmsg(3C).
236
237
238 TERM
239
240 The kind of terminal for which output is to be prepared. This
241 information is used by commands, such as vi(1), which may exploit
242 special capabilities of that terminal.
243
244
245 TZ
246
247 Timezone information. The contents of this environment variable are
248 used by the functions ctime(3C), localtime(3C), strftime(3C), and
249 mktime(3C) to override the default timezone. The value of TZ has
250 one of the two formats (spaces inserted for clarity):
251
252 :characters
253
254 or
255
256 std offset dst offset, rule
257
258 If TZ is of the first format (that is, if the first character is a
259 colon (:)), or if TZ is not of the second format, then TZ desig‐
260 nates a path to a timezone database file relative to
261 /usr/share/lib/zoneinfo/, ignoring a leading colon if one exists.
262
263 Otherwise, TZ is of the second form, which when expanded is as fol‐
264 lows:
265
266 stdoffset[dst[offset][,start[/time],end[/time]]]
267
268
269 std and dst
270
271 Indicate no less than three, nor more than {TZNAME_MAX}, bytes
272 that are the designation for the standard (std) or the alterna‐
273 tive (dst, such as Daylight Savings Time) timezone. Only std is
274 required; if dst is missing, then the alternative time does not
275 apply in this timezone. Each of these fields can occur in
276 either of two formats, quoted or unquoted:
277
278 o In the quoted form, the first character is the less-
279 than ('<') character and the last character is the
280 greater-than ('>') character. All characters between
281 these quoting characters are alphanumeric characters
282 from the portable character set in the current
283 locale, the plus-sign ('+') character, or the minus-
284 sign ('-') character. The std and dst fields in this
285 case do not include the quoting characters.
286
287 o In the unquoted form, all characters in these fields
288 are alphabetic characters from the portable charac‐
289 ter set in the current locale.
290 The interpretation of these fields is unspecified if either
291 field is less than three bytes (except for the case when dst is
292 missing), more than {TZNAME_MAX} bytes, or if they contain
293 characters other than those specified.
294
295
296 offset
297
298 Indicate the value one must add to the local time to arrive at
299 Coordinated Universal Time. The offset has the form:
300
301 hh[:mm[:ss]]
302
303
304 The minutes (mm) and seconds (ss) are optional. The hour (hh)
305 is required and can be a single digit. The offset following std
306 is required. If no offset follows dst, daylight savings time is
307 assumed to be one hour ahead of standard time. One or more dig‐
308 its can be used. The value is always interpreted as a decimal
309 number. The hour must be between 0 and 24, and the minutes (and
310 seconds), if present, must be between 0 and 59. Out of range
311 values can cause unpredictable behavior. If preceded by a "-",
312 the timezone is east of the Prime Meridian. Otherwise, it is
313 west of the Prime Meridian (which can be indicated by an
314 optional preceding "+" sign).
315
316
317 start/time,end/time
318
319 Indicate when to change to and back from daylight savings time,
320 where start/time describes when the change from standard time
321 to daylight savings time occurs, and end/time describes when
322 the change back occurs. Each time field describes when, in
323 current local time, the change is made.
324
325 The formats of start and end are one of the following:
326
327 Jn
328
329 The Julian day n (1 ≤ n ≤ 365). Leap days are not counted.
330 That is, in all years, February 28 is day 59 and March 1 is
331 day 60. It is impossible to refer to the occasional Febru‐
332 ary 29.
333
334
335 n
336
337 The zero-based Julian day (0 ≤ n ≤ 365). Leap days are
338 counted, and it is possible to refer to February 29.
339
340
341 Mm.n.d
342
343 The d^th day, (0 ≤ d ≤ 6) of week n of month m of the year
344 (1 ≤ n ≤ 5, 1 ≤ m ≤ 12), where week 5 means "the last d-day
345 in month m" which may occur in either the fourth or the
346 fifth week). Week 1 is the first week in which the d^th day
347 occurs. Day zero is Sunday.
348
349 Implementation specific defaults are used for start and end if
350 these optional fields are not specified.
351
352 The time has the same format as offset except that no leading
353 sign ("-" or "+" ) is allowed. If time is not specified, the
354 default value is 02:00:00.
355
356
357
359 cat(1), date(1), ed(1), fmtmsg(1), localedef(1), login(1), ls(1),
360 mkmsgs(1), nice(1), nohup(1), sh(1), sort(1), time(1), vi(1), exec(2),
361 addseverity(3C), catopen(3C), ctime(3C), ctype(3C), fmtmsg(3C), get‐
362 date(3C), getnetpath(3NSL), gettext(3C), gettxt(3C), localeconv(3C),
363 mblen(3C), mktime(3C), printf(3C), setlocale(3C), strcoll(3C), strf‐
364 time(3C), strtod(3C), strxfrm(3C), TIMEZONE(4), netconfig(4),
365 passwd(4), profile(4)
366
367
368
369SunOS 5.11 19 Nov 2002 environ(5)