env - set environment for command
env [-ia] [name=value] ... [utility [argument...]]
Env modifies its environment according to the name=value arguments, and
executes utility with the given arguments and the modified environment.
If no utility is specified then the modified environment is printed as
name=value strings, one per line.
-i Use exactly the environment specified by the arguments; the
inherited environment is ignored.
-a Specify all arguments for the utility, i.e. the first of the
arguments is used as argv, the program name. Normally the
program name is utility itself.
PATH The path used to find utility. It is as modified by env, i.e.
not the inherited PATH.
sh(1), execvp(3), environ(5).
The return code is 0 after successfully printing the environment, 1 on an
error within env, 126 if the utility could not be executed, or 127 if
utility could not be found. Appropriate diagnostic messages are printed
on standard error. If utility can be executed then it replaces env, so
the return code is then the return code of utility.
When run from the standard shell env is only useful with options or
without arguments. Otherwise the shell can do exactly what env can do,
simply omit the word "env" on the command line.
One interesting use of env is with #! on the first line of a script to
forge a PATH search for an interpreter. For example:
This will find the Perl interpreter if it is within the user's PATH.
Most UNIX-like systems have env in /usr/bin, but perl may be anywhere.
Kees J. Bot <firstname.lastname@example.org>