xref: /openbsd/usr.bin/env/env.1 (revision 3d8817e4)
1.\"	$OpenBSD: env.1,v 1.18 2010/09/29 07:44:56 jmc Exp $
2.\" Copyright (c) 1980, 1990 The Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" the Institute of Electrical and Electronics Engineers, Inc.
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	from: @(#)printenv.1	6.7 (Berkeley) 7/28/91
32.\"
33.Dd $Mdocdate: September 29 2010 $
34.Dt ENV 1
35.Os
36.Sh NAME
37.Nm env
38.Nd set and print environment
39.Sh SYNOPSIS
40.Nm env
41.Op Fl i
42.Oo
43.Ar name Ns = Ns Ar value ...
44.Oc
45.Oo
46.Ar utility
47.Op Ar argument ...
48.Oc
49.Sh DESCRIPTION
50.Nm
51executes
52.Ar utility
53after modifying the environment as
54specified on the command line.
55The option
56.Ar name Ns = Ns Ar value
57specifies
58an environment variable,
59.Ar name ,
60with a value of
61.Ar value .
62.Pp
63The options are as follows:
64.Bl -tag -width Ds
65.It Fl i
66Causes
67.Nm
68to completely ignore the environment it inherits.
69.El
70.Pp
71If no
72.Ar utility
73is specified,
74.Nm
75prints out the names and values
76of the variables in the environment, with one
77.Ar name Ns = Ns Ar value
78pair per line.
79.Sh EXIT STATUS
80The
81.Nm
82utility exits with one of the following values:
83.Bl -tag -width Ds
84.It 0
85.Ar utility
86was invoked and completed successfully.
87In this case the exit code is returned by the utility itself, not
88.Nm .
89If no utility was specified, then
90.Nm
91completed successfully and returned the exit code itself.
92.It 1
93An invalid command line option was passed to
94.Nm .
95.It 1\(en125
96.Ar utility
97was invoked but failed in some way;
98see its manual page for more information.
99In this case the exit code is returned by the utility itself, not
100.Nm .
101.It 126
102.Ar utility
103was found but could not be invoked.
104.It 127
105.Ar utility
106could not be found.
107.El
108.Sh SEE ALSO
109.Xr execvp 3 ,
110.Xr environ 7
111.Sh STANDARDS
112The
113.Nm
114utility is compliant with the
115.St -p1003.1-2008
116specification.
117.Pp
118The historic
119.Fl
120option has been deprecated but is still supported in this implementation.
121.Sh BUGS
122.Nm
123doesn't handle commands with equal
124.Pq Sq =
125signs in their
126names, for obvious reasons.
127