add UNLEASHED_OBJ to unleashed.mk
[unleashed/tickless.git] / bin / env / env.1
blob44b6faf4473dc6c1a7213cdcefc643a9aacfab44
1 '\" te
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"
11 .SH NAME
12 env \- set environment for command invocation
13 .SH SYNOPSIS
14 .LP
15 .nf
16 \fB/usr/bin/env\fR [\fB-i\fR | \fB-\fR] [\fIname=value\fR]...
17      [\fIutility\fR [\fIarg\fR... ]]
18 .fi
20 .SH DESCRIPTION
21 .sp
22 .LP
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.
26 .sp
27 .LP
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.
31 .sp
32 .LP
33 If \fBenv\fR executes commands with arguments, it uses the default shell
34 \fB/usr/bin/sh\fR (see \fBsh\fR(1)).
35 .SH OPTIONS
36 .sp
37 .LP
38 The following options are supported:
39 .sp
40 .ne 2
41 .na
42 \fB\fB-i\fR | \fB\(mi\fR \fR
43 .ad
44 .RS 14n
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
47 arguments.
48 .RE
50 .SH OPERANDS
51 .sp
52 .LP
53 The following operands are supported:
54 .sp
55 .ne 2
56 .na
57 \fB\fIname\fR\fB=\fR\fIvalue\fR \fR
58 .ad
59 .RS 15n
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
62 is invoked.
63 .RE
65 .sp
66 .ne 2
67 .na
68 \fB\fIutility\fR \fR
69 .ad
70 .RS 15n
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.
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fIarg\fR \fR
79 .ad
80 .RS 15n
81 A string to pass as an argument for the invoked utility.
82 .RE
84 .SH EXAMPLES
85 .LP
86 \fBExample 1 \fRInvoking utilities with new PATH values
87 .sp
88 .LP
89 The following utility:
91 .sp
92 .in +2
93 .nf
94 example% \fBenv -i PATH=/mybin mygrep xyz myfile \fR
95 .fi
96 .in -2
97 .sp
99 .sp
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.
112 .ne 2
114 \fB\fBPATH\fR\fR
116 .RS 8n
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.
122 .SH EXIT STATUS
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
127 exit values:
129 .ne 2
131 \fB\fB0\fR \fR
133 .RS 10n
134 Successful completion.
138 .ne 2
140 \fB\fB1-125\fR \fR
142 .RS 10n
143 An error occurred.
147 .ne 2
149 \fB\fB126\fR \fR
151 .RS 10n
152 \fIutility\fR was found but could not be invoked.
156 .ne 2
158 \fB\fB127\fR \fR
160 .RS 10n
161 \fIutility\fR could not be found.
164 .SH ATTRIBUTES
167 See \fBattributes\fR(5) for descriptions of the following attributes:
168 .SS "/usr/bin"
173 box;
174 c | c
175 l | l .
176 ATTRIBUTE TYPE  ATTRIBUTE VALUE
178 CSI     enabled
180 Interface Stability     Standard
183 .SH SEE ALSO
186 \fBksh\fR(1), \fBsh\fR(1), \fBexec\fR(2), \fBprofile\fR(4),
187 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)