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 "Oct 25, 2017"
12 env \- set environment for command invocation
16 \fB/usr/bin/env\fR [\fB-i\fR | \fB-\fR] [\fIname=value\fR]...
17 [\fIutility\fR [\fIarg\fR... ]]
23 The \fBenv\fR utility obtains the current environment, modifies it according to
24 its arguments, then invokes the utility named by the \fIutility\fR operand with
25 the modified environment.
28 Optional arguments are passed to \fIutility\fR. If no \fIutility\fR operand is
29 specified, the resulting environment is written to the standard output, with
30 one \fIname\fR\fB=\fR\fIvalue\fR pair per line.
33 If \fBenv\fR executes commands with arguments, it uses the default shell
34 \fB/usr/bin/sh\fR (see \fBsh\fR(1)).
38 The following options are supported:
42 \fB\fB-i\fR | \fB\(mi\fR \fR
45 Ignores the environment that would otherwise be inherited from the current
46 shell. Restricts the environment for \fIutility\fR to that specified by the
53 The following operands are supported:
57 \fB\fIname\fR\fB=\fR\fIvalue\fR \fR
60 Arguments of the form \fIname\fR\fB=\fR\fIvalue\fR modify the execution
61 environment, and are placed into the inherited environment before \fIutility\fR
71 The name of the utility to be invoked. If \fIutility\fR names any of the
72 special shell built-in utilities, the results are undefined.
81 A string to pass as an argument for the invoked utility.
86 \fBExample 1 \fRInvoking utilities with new PATH values
89 The following utility:
94 example% \fBenv -i PATH=/mybin mygrep xyz myfile \fR
101 invokes the utility \fBmygrep\fR with a new \fBPATH\fR value as the only entry
102 in its environment. In this case, \fBPATH\fR is used to locate \fBmygrep\fR,
103 which then must reside in \fB/mybin\fR.
105 .SH ENVIRONMENT VARIABLES
108 See \fBenviron\fR(5) for descriptions of the following environment variables
109 that affect the execution of \fBenv\fR: \fBLANG\fR, \fBLC_ALL\fR,
110 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
117 Determine the location of the \fIutility\fR. If \fBPATH\fR is specified as a
118 \fIname\fR=\fIvalue\fR operand to \fBenv\fR, the value given shall be used in
119 the search for \fIutility\fR.
125 If \fIutility\fR is invoked, the exit status of \fBenv\fR is the exit status of
126 \fIutility\fR. Otherwise, the \fBenv\fR utility returns one of the following
134 Successful completion.
152 \fIutility\fR was found but could not be invoked.
161 \fIutility\fR could not be found.
167 See \fBattributes\fR(5) for descriptions of the following attributes:
176 ATTRIBUTE TYPE ATTRIBUTE VALUE
180 Interface Stability Standard
186 \fBksh\fR(1), \fBsh\fR(1), \fBexec\fR(2), \fBprofile\fR(4),
187 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)