NAME

     env - set environment for command


SYNOPSIS

     env [-ia] [name=value] ...  [utility [argument...]]


DESCRIPTION

     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.


OPTIONS

     -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[0], the program name.
          Normally the program name is utility itself.


ENVIRONMENT

     PATH    The path used to find utility.  It is as modified by
             env, i.e.  not the inherited PATH.


SEE ALSO

     sh(1), execvp(3), environ(5).


DIAGNOSTICS

     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.


NOTES

     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 exam-
     ple:

          #!/usr/bin/env perl

     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.


AUTHOR

     Kees J. Bot <kjb@cs.vu.nl>