1env(1)                           User Commands                          env(1)
2
3
4

NAME

6       env - set environment for command invocation
7

SYNOPSIS

9       /usr/bin/env [-i | -] [name=value]... [utility [arg... ]]
10
11
12       /usr/xpg4/bin/env [-i | -] [name=value]...
13            [utility [arg... ]]
14
15

DESCRIPTION

17       The  env utility obtains the current environment, modifies it according
18       to its arguments, then invokes the utility named by the utility operand
19       with the modified environment.
20
21
22       Optional  arguments  are  passed  to  utility. If no utility operand is
23       specified, the resulting environment is written to the standard output,
24       with one name=value pair per line.
25
26   /usr/bin
27       If  env  executes  commands  with  arguments, it uses the default shell
28       /usr/bin/sh (see sh(1)).
29
30   /usr/xpg4/bin
31       If env executes commands with arguments, it uses /usr/xpg4/bin/sh  (see
32       ksh(1)).
33

OPTIONS

35       The following options are supported:
36
37       -i | Ignores the environment that would otherwise be inherited
38                     from the current shell.  Restricts  the  environment  for
39                     utility to that specified by the arguments.
40
41

OPERANDS

43       The following operands are supported:
44
45       name=value     Arguments  of  the  form name=value modify the execution
46                      environment, and are placed into the inherited  environ‐
47                      ment before utility is invoked.
48
49
50       utility        The name of the utility to be invoked.  If utility names
51                      any of the special shell built-in utilities, the results
52                      are undefined.
53
54
55       arg            A string to pass as an argument for the invoked utility.
56
57

EXAMPLES

59       Example 1 Invoking utilities with new PATH values
60
61
62       The following utility:
63
64
65         example% env -i PATH=/mybin mygrep xyz myfile
66
67
68
69
70       invokes  the  utility mygrep with a new PATH value as the only entry in
71       its environment. In this case, PATH is used  to  locate  mygrep,  which
72       then must reside in /mybin.
73
74

ENVIRONMENT VARIABLES

76       See  environ(5) for descriptions of the following environment variables
77       that affect the execution of env: LANG, LC_ALL, LC_CTYPE,  LC_MESSAGES,
78       and NLSPATH.
79
80       PATH    Determine  the location of the utility. If PATH is specified as
81               a name=value operand to env, the value given shall be  used  in
82               the search for utility.
83
84

EXIT STATUS

86       If  utility  is  invoked,  the exit status of env is the exit status of
87       utility. Otherwise, the env utility returns one of the  following  exit
88       values:
89
90       0         Successful completion.
91
92
93       1-125     An error occurred.
94
95
96       126       utility was found but could not be invoked.
97
98
99       127       utility could not be found.
100
101

ATTRIBUTES

103       See attributes(5) for descriptions of the following attributes:
104
105   /usr/bin
106       ┌─────────────────────────────┬─────────────────────────────┐
107       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
108       ├─────────────────────────────┼─────────────────────────────┤
109       │Availability                 │SUNWcsu                      │
110       ├─────────────────────────────┼─────────────────────────────┤
111       │CSI                          │enabled                      │
112       └─────────────────────────────┴─────────────────────────────┘
113
114   /usr/xpg4/bin
115       ┌─────────────────────────────┬─────────────────────────────┐
116       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
117       ├─────────────────────────────┼─────────────────────────────┤
118       │Availability                 │SUNWxcu4                     │
119       ├─────────────────────────────┼─────────────────────────────┤
120       │CSI                          │enabled                      │
121       ├─────────────────────────────┼─────────────────────────────┤
122       │Interface Stability          │Standard                     │
123       └─────────────────────────────┴─────────────────────────────┘
124

SEE ALSO

126       ksh(1),  sh(1),  exec(2),  profile(4), attributes(5), environ(5), stan‐
127       dards(5)
128
129
130
131SunOS 5.11                        2 Jan 2002                            env(1)
Impressum