<s>
env	B-Device
is	O
a	O
shell	B-Application
command	B-Application
for	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
.	O
</s>
<s>
Using	O
env	B-Device
,	O
variables	O
may	O
be	O
added	O
or	O
removed	O
,	O
and	O
existing	O
variables	O
may	O
be	O
changed	O
by	O
assigning	O
new	O
values	O
to	O
them	O
.	O
</s>
<s>
In	O
practice	O
,	O
env	B-Device
has	O
another	O
common	O
use	O
.	O
</s>
<s>
It	O
is	O
often	O
used	O
by	O
shell	B-Language
scripts	I-Language
to	O
launch	O
the	O
correct	O
interpreter	B-Application
.	O
</s>
<s>
The	O
version	O
of	O
env	B-Device
bundled	O
in	O
GNU	B-Application
coreutils	I-Application
was	O
written	O
by	O
Richard	O
Mlynarik	O
,	O
David	O
MacKenzie	O
,	O
and	O
Assaf	O
Gordon	O
.	O
</s>
<s>
GNU	B-Operating_System
's	O
has	O
been	O
extended	O
to	O
handle	O
signals	O
and	O
the	O
current	O
directory	O
.	O
</s>
<s>
FreeBSD	B-Operating_System
's	O
supports	O
a	O
custom	O
search	O
path	B-Application
.	O
</s>
<s>
Extensions	O
found	O
in	O
both	O
versions	O
include	O
,	O
for	O
unsetting	O
variables	O
,	O
and	O
,	O
for	O
splitting	O
arguments	O
(	O
mainly	O
in	O
shebang	B-Operating_System
)	O
.	O
</s>
<s>
To	O
create	O
a	O
new	O
environment	O
without	O
any	O
existing	O
environment	O
variables	O
for	O
a	O
new	O
shell	B-Application
:	O
</s>
<s>
To	O
execute	O
the	O
X	B-Operating_System
application	O
xcalc	O
and	O
have	O
it	O
appear	O
on	O
a	O
different	O
display	O
(	O
i.e.	O
,	O
with	O
a	O
modified	O
environment	O
whether	O
the	O
specified	O
environment	O
variable	O
is	O
replaced	O
with	O
the	O
new	O
value	O
)	O
:	O
</s>
<s>
Note	O
that	O
this	O
use	O
of	O
env	B-Device
is	O
often	O
unnecessary	O
since	O
most	O
shells	O
support	O
setting	O
environment	O
variables	O
in	O
front	O
of	O
a	O
command	B-Application
:	O
</s>
<s>
env	B-Device
may	O
also	O
be	O
used	O
in	O
the	O
hashbang	B-Operating_System
line	O
of	O
a	O
script	O
to	O
allow	O
the	O
interpreter	B-Application
to	O
be	O
looked	O
up	O
via	O
the	O
PATH	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
here	O
is	O
the	O
code	O
of	O
a	O
Python	B-Language
script	I-Language
:	O
</s>
<s>
In	O
this	O
example	O
,	O
/usr/bin/env	B-Device
is	O
the	O
full	B-Application
path	I-Application
of	O
the	O
env	B-Device
command	B-Application
.	O
</s>
<s>
Note	O
that	O
it	O
is	O
possible	O
to	O
specify	O
the	O
interpreter	B-Application
without	O
using	O
env	B-Device
,	O
by	O
giving	O
the	O
full	B-Application
path	I-Application
of	O
the	O
python	B-Language
interpreter	B-Application
.	O
</s>
<s>
A	O
problem	O
with	O
that	O
approach	O
is	O
that	O
on	O
different	O
computer	O
systems	O
,	O
the	O
exact	O
path	B-Application
may	O
be	O
different	O
.	O
</s>
<s>
By	O
instead	O
using	O
env	B-Device
as	O
in	O
the	O
example	O
,	O
the	O
interpreter	B-Application
is	O
searched	O
for	O
and	O
located	O
at	O
the	O
time	O
the	O
script	O
is	O
run	O
(	O
more	O
precisely	O
,	O
env	B-Device
does	O
a	O
system	O
call	O
to	O
execvp	O
,	O
which	O
does	O
the	O
job	O
of	O
locating	O
the	O
interpreter	B-Application
and	O
launching	O
it	O
)	O
.	O
</s>
<s>
This	O
makes	O
the	O
script	O
more	O
portable	O
,	O
but	O
also	O
increases	O
the	O
risk	O
that	O
the	O
wrong	O
interpreter	B-Application
is	O
selected	O
because	O
it	O
searches	O
for	O
a	O
match	O
in	O
every	O
directory	O
on	O
the	O
executable	O
search	O
path	B-Application
.	O
</s>
<s>
It	O
also	O
suffers	O
from	O
the	O
same	O
problem	O
in	O
that	O
the	O
path	B-Application
to	O
the	O
env	B-Device
binary	O
may	O
also	O
be	O
different	O
on	O
a	O
per-machine	O
basis	O
.	O
</s>
