env

display environment, set environment for process 

Command


SYNOPSIS

env [-i] [variable=value...] [command argument...]

env [-] [variable=value...] [command argument...]


DESCRIPTION

If you call env with no arguments, it displays the environment that it received from its parent (presumably the shell).

Arguments of the form

variable=value

let you add new variables or change the value in existing variables of the environment.

If you specify command, 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.

Options

-i 

does not use the environment inherited by env

- 

is an obsolete version of -i


EXAMPLES

Compare the output of the following two examples which illustrate the use of env:

env foo=bar env
env -i foo=bar env

ENVIRONMENT VARIABLES

PATH 

contains a list of directories to search when attempting to find command.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following

— insufficient memory
— name is too long
2 

Invalid command line argument.

126 

env found command but was unable to invoke it.

127 

env was unable to find command.

Too many environment variables 

The maximum number of environment variables that can be specified in a single env command is 512.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. UNIX System V. Windows 2000. Windows XP. Windows Server 2003. Windows Vista.

printenv on Berkeley UNIX systems has similar functionality.


NOTE

Normally, MKS KornShell variable names can only contain alphanumeric characters and the underscore (_), 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

AVAILABILITY

MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
sh

Miscellaneous:
envvar


MKS Toolkit 9.2 Documentation Build 16.