xref: /openbsd/usr.bin/env/env.1 (revision a4e071cf)
1*a4e071cfSderaadt.\"	$OpenBSD: env.1,v 1.20 2015/01/12 21:42:53 deraadt Exp $
2df930be7Sderaadt.\" Copyright (c) 1980, 1990 The Regents of the University of California.
3df930be7Sderaadt.\" All rights reserved.
4df930be7Sderaadt.\"
5df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by
6df930be7Sderaadt.\" the Institute of Electrical and Electronics Engineers, Inc.
7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
8df930be7Sderaadt.\" modification, are permitted provided that the following conditions
9df930be7Sderaadt.\" are met:
10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
11df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
13df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
14df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
15f75387cbSmillert.\" 3. Neither the name of the University nor the names of its contributors
16df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
17df930be7Sderaadt.\"    without specific prior written permission.
18df930be7Sderaadt.\"
19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29df930be7Sderaadt.\" SUCH DAMAGE.
30df930be7Sderaadt.\"
31df930be7Sderaadt.\"	from: @(#)printenv.1	6.7 (Berkeley) 7/28/91
32df930be7Sderaadt.\"
33*a4e071cfSderaadt.Dd $Mdocdate: January 12 2015 $
34df930be7Sderaadt.Dt ENV 1
35df930be7Sderaadt.Os
36df930be7Sderaadt.Sh NAME
37df930be7Sderaadt.Nm env
38df930be7Sderaadt.Nd set and print environment
39df930be7Sderaadt.Sh SYNOPSIS
40df930be7Sderaadt.Nm env
41df930be7Sderaadt.Op Fl i
422e0eb34fSaaron.Oo
43d741230eSjmc.Ar name Ns = Ns Ar value ...
442e0eb34fSaaron.Oc
45df930be7Sderaadt.Oo
46df930be7Sderaadt.Ar utility
47a06b6ec4Saaron.Op Ar argument ...
48df930be7Sderaadt.Oc
49df930be7Sderaadt.Sh DESCRIPTION
502e0eb34fSaaron.Nm
51df930be7Sderaadtexecutes
52df930be7Sderaadt.Ar utility
53df930be7Sderaadtafter modifying the environment as
5496366692Saaronspecified on the command line.
5596366692SaaronThe option
56d741230eSjmc.Ar name Ns = Ns Ar value
57df930be7Sderaadtspecifies
583b83c268Sderaadtan environment variable,
59df930be7Sderaadt.Ar name ,
60df930be7Sderaadtwith a value of
61df930be7Sderaadt.Ar value .
6296366692Saaron.Pp
6396366692SaaronThe options are as follows:
6496366692Saaron.Bl -tag -width Ds
6596366692Saaron.It Fl i
6696366692SaaronCauses
672e0eb34fSaaron.Nm
6896366692Saaronto completely ignore the environment it inherits.
6996366692Saaron.El
70df930be7Sderaadt.Pp
71df930be7SderaadtIf no
72df930be7Sderaadt.Ar utility
73df930be7Sderaadtis specified,
742e0eb34fSaaron.Nm
75df930be7Sderaadtprints out the names and values
76df930be7Sderaadtof the variables in the environment, with one
77d741230eSjmc.Ar name Ns = Ns Ar value
78df930be7Sderaadtpair per line.
79*a4e071cfSderaadt.Pp
80*a4e071cfSderaadt.Nm
81*a4e071cfSderaadtdoesn't handle commands with equal
82*a4e071cfSderaadt.Pq Sq =
83*a4e071cfSderaadtsigns in their
84*a4e071cfSderaadtnames, for obvious reasons.
8511c0d3b3Sjmc.Sh EXIT STATUS
8611c0d3b3SjmcThe
872e0eb34fSaaron.Nm
8811c0d3b3Sjmcutility exits with one of the following values:
89df930be7Sderaadt.Bl -tag -width Ds
90df930be7Sderaadt.It 0
918415ff6cSjmc.Nm
92995d26aaSschwarzecompleted successfully and, if
93995d26aaSschwarze.Ar utility
94995d26aaSschwarzewas specified, it was invoked and completed successfully too.
958415ff6cSjmc.It 1
968415ff6cSjmcAn invalid command line option was passed to
97995d26aaSschwarze.Nm
98995d26aaSschwarzeand
998415ff6cSjmc.Ar utility
100995d26aaSschwarzewas not invoked, or
101995d26aaSschwarze.Ar utility
102995d26aaSschwarzewas invoked but failed with exit status 1.
103995d26aaSschwarze.It 2\(en125, 128\(en255
104995d26aaSschwarze.Ar utility
105995d26aaSschwarzewas invoked but failed with this exit status;
1068415ff6cSjmcsee its manual page for more information.
1078415ff6cSjmc.It 126
1088415ff6cSjmc.Ar utility
109995d26aaSschwarzewas found but could not be invoked, or it was invoked but failed
110995d26aaSschwarzewith exit status 126.
111df930be7Sderaadt.It 127
112df930be7Sderaadt.Ar utility
113995d26aaSschwarzecould not be found, or it was invoked but failed with exit status 127.
114df930be7Sderaadt.El
1153746a816Saaron.Sh SEE ALSO
1163746a816Saaron.Xr execvp 3 ,
1173746a816Saaron.Xr environ 7
1182aeff9fbSjmc.Sh STANDARDS
1197c5a075bSjmcThe
1207c5a075bSjmc.Nm
1217c5a075bSjmcutility is compliant with the
12299332e38Sjmc.St -p1003.1-2008
1237c5a075bSjmcspecification.
1247c5a075bSjmc.Pp
125694c9f6dSrayThe historic
126694c9f6dSray.Fl
127694c9f6dSrayoption has been deprecated but is still supported in this implementation.
128