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 limited only by available memory. When exhausted this error will be displayed..


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. UNIX System V. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

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

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


SEE ALSO

Commands:
sh

Miscellaneous:
envvar


PTC MKS Toolkit 10.1 Documentation Build 15.