envdisplay environment, set environment for process |
Command |
env
[-i
]
[variable=value...]
[command argument...]
env
[-
]
[variable=value...]
[command argument...]
env
with no arguments, it displays the
environment that it received from its parent (presumably the shell).
Arguments of the form
let you add new variables or change the value in existing variables of the environment. If you specify command,variable=value
env
calls command
with the arguments that appear on the command line, passing the
accumulated environment to this command. The command is executed directly
as a program found in the search PATH
and is not
interpreted by a shell.
-i
does not use the environment inherited by
env
-
is an obsolete version of -i
env
:
env foo=bar env env -i foo=bar env
PATH
contains a list of directories to search when attempting to find command.
0
Successful completion.
1
Failure due to any of the following
2
Invalid command line argument.
126
env
found command
but was unable to invoke it.
127
env
was unable to find command.
The maximum number of environment variables that can be specified
in a single env
command is 512.
printenv
on Berkeley UNIX systems has similar functionality.
_
), and cannot begin with a digit; however,
some applications require a shell variable to be set that does not follow these
naming conventions. To set such a variable, you can use the
env
command to insert the normally invalid name directly
into the environment block. For example, to run a program that requires a
variable named 386
to be set to yes
, you can use
the following command:
env '386=yes' program
sh
envvar