1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man1 / env.1
blob3c8612c0a88c40a300c3a7a025a5208ee043c773
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 "Jan 2, 2002"
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]... [\fIutility\fR [\fIarg\fR... ]]
17 .fi
19 .LP
20 .nf
21 \fB/usr/xpg4/bin/env\fR [\fB-i\fR | \fB-\fR] [\fIname=value\fR]...
22      [\fIutility\fR [\fIarg\fR... ]]
23 .fi
25 .SH DESCRIPTION
26 .sp
27 .LP
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.
31 .sp
32 .LP
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.
36 .sp
37 .LP
38 If \fBenv\fR executes commands with arguments, it uses the default shell
39 \fB/usr/bin/sh\fR (see \fBsh\fR(1)).
40 .SH OPTIONS
41 .sp
42 .LP
43 The following options are supported:
44 .sp
45 .ne 2
46 .na
47 \fB\fB-i\fR | \fB\(mi\fR \fR
48 .ad
49 .RS 14n
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
52 arguments.
53 .RE
55 .SH OPERANDS
56 .sp
57 .LP
58 The following operands are supported:
59 .sp
60 .ne 2
61 .na
62 \fB\fIname\fR\fB=\fR\fIvalue\fR \fR
63 .ad
64 .RS 15n
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
67 is invoked.
68 .RE
70 .sp
71 .ne 2
72 .na
73 \fB\fIutility\fR \fR
74 .ad
75 .RS 15n
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.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fIarg\fR \fR
84 .ad
85 .RS 15n
86 A string to pass as an argument for the invoked utility.
87 .RE
89 .SH EXAMPLES
90 .LP
91 \fBExample 1 \fRInvoking utilities with new PATH values
92 .sp
93 .LP
94 The following utility:
96 .sp
97 .in +2
98 .nf
99 example% \fBenv -i PATH=/mybin mygrep xyz myfile \fR
101 .in -2
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.
117 .ne 2
119 \fB\fBPATH\fR\fR
121 .RS 8n
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.
127 .SH EXIT STATUS
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
132 exit values:
134 .ne 2
136 \fB\fB0\fR \fR
138 .RS 10n
139 Successful completion.
143 .ne 2
145 \fB\fB1-125\fR \fR
147 .RS 10n
148 An error occurred.
152 .ne 2
154 \fB\fB126\fR \fR
156 .RS 10n
157 \fIutility\fR was found but could not be invoked.
161 .ne 2
163 \fB\fB127\fR \fR
165 .RS 10n
166 \fIutility\fR could not be found.
169 .SH ATTRIBUTES
172 See \fBattributes\fR(5) for descriptions of the following attributes:
173 .SS "/usr/bin"
178 box;
179 c | c
180 l | l .
181 ATTRIBUTE TYPE  ATTRIBUTE VALUE
183 CSI     enabled
186 .SS "/usr/xpg4/bin"
191 box;
192 c | c
193 l | l .
194 ATTRIBUTE TYPE  ATTRIBUTE VALUE
196 CSI     enabled
198 Interface Stability     Standard
201 .SH SEE ALSO
204 \fBksh\fR(1), \fBsh\fR(1), \fBexec\fR(2), \fBprofile\fR(4),
205 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)