manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

22.2 env: Run a command in a modified environment

env runs a command with a modified environment. Synopses:

 
env [option]… [name=value]… [command [args]…]
env

Operands of the form ‘variable=value’ set the environment variable variable to value value. value may be empty (‘variable=’). Setting a variable to an empty value is different from unsetting it. These operands are evaluated left-to-right, so if two operands mention the same variable the earlier is ignored.

Environment variable names can be empty, and can contain any characters other than ‘=’ and the null character (ASCII NUL). However, it is wise to limit yourself to names that consist solely of underscores, digits, and ASCII letters, and that begin with a non-digit, as applications like the shell do not work well with other names.

The first operand that does not contain the character ‘=’ specifies the program to invoke; it is searched for according to the PATH environment variable. Any remaining arguments are passed as arguments to that program. The program should not be a special built-in utility (see section Special built-in utilities).

If no command name is specified following the environment specifications, the resulting environment is printed. This is like specifying the printenv program.

The program accepts the following options. Also see Common options. Options must precede operands.

-u name
--unset=name

Remove variable name from the environment, if it was in the environment.

-
-i
--ignore-environment

Start with an empty environment, ignoring the inherited environment.

Exit status:

 
0   if no command is specified and the environment is output
1   if env itself fails
126 if command is found but cannot be invoked
127 if command cannot be found
the exit status of command otherwise

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.