2 .\" Copyright 1989 AT&T Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH ENV 1 "Jan 2, 2002"
12 env \- set environment for command invocation
16 \fB/usr/bin/env\fR [\fB-i\fR | \fB-\fR] [\fIname=value\fR]... [\fIutility\fR [\fIarg\fR... ]]
21 \fB/usr/xpg4/bin/env\fR [\fB-i\fR | \fB-\fR] [\fIname=value\fR]...
22 [\fIutility\fR [\fIarg\fR... ]]
28 The \fBenv\fR utility obtains the current environment, modifies it according to
29 its arguments, then invokes the utility named by the \fIutility\fR operand with
30 the modified environment.
33 Optional arguments are passed to \fIutility\fR. If no \fIutility\fR operand is
34 specified, the resulting environment is written to the standard output, with
35 one \fIname\fR\fB=\fR\fIvalue\fR pair per line.
38 If \fBenv\fR executes commands with arguments, it uses the default shell
39 \fB/usr/bin/sh\fR (see \fBsh\fR(1)).
43 The following options are supported:
47 \fB\fB-i\fR | \fB\(mi\fR \fR
50 Ignores the environment that would otherwise be inherited from the current
51 shell. Restricts the environment for \fIutility\fR to that specified by the
58 The following operands are supported:
62 \fB\fIname\fR\fB=\fR\fIvalue\fR \fR
65 Arguments of the form \fIname\fR\fB=\fR\fIvalue\fR modify the execution
66 environment, and are placed into the inherited environment before \fIutility\fR
76 The name of the utility to be invoked. If \fIutility\fR names any of the
77 special shell built-in utilities, the results are undefined.
86 A string to pass as an argument for the invoked utility.
91 \fBExample 1 \fRInvoking utilities with new PATH values
94 The following utility:
99 example% \fBenv -i PATH=/mybin mygrep xyz myfile \fR
106 invokes the utility \fBmygrep\fR with a new \fBPATH\fR value as the only entry
107 in its environment. In this case, \fBPATH\fR is used to locate \fBmygrep\fR,
108 which then must reside in \fB/mybin\fR.
110 .SH ENVIRONMENT VARIABLES
113 See \fBenviron\fR(5) for descriptions of the following environment variables
114 that affect the execution of \fBenv\fR: \fBLANG\fR, \fBLC_ALL\fR,
115 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
122 Determine the location of the \fIutility\fR. If \fBPATH\fR is specified as a
123 \fIname\fR=\fIvalue\fR operand to \fBenv\fR, the value given shall be used in
124 the search for \fIutility\fR.
130 If \fIutility\fR is invoked, the exit status of \fBenv\fR is the exit status of
131 \fIutility\fR. Otherwise, the \fBenv\fR utility returns one of the following
139 Successful completion.
157 \fIutility\fR was found but could not be invoked.
166 \fIutility\fR could not be found.
172 See \fBattributes\fR(5) for descriptions of the following attributes:
181 ATTRIBUTE TYPE ATTRIBUTE VALUE
194 ATTRIBUTE TYPE ATTRIBUTE VALUE
198 Interface Stability Standard
204 \fBksh\fR(1), \fBsh\fR(1), \fBexec\fR(2), \fBprofile\fR(4),
205 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)