Skip Navigation Links | |
Exit Print View | |
man pages section 1: User Commands Oracle Solaris 11.1 Information Library |
- set environment for command invocation
/usr/bin/env [-i | -] [name=value]... [utility [arg... ]]
/usr/xpg4/bin/env [-i | -] [name=value]... [utility [arg... ]]
The env utility obtains the current environment, modifies it according to its arguments, then invokes the utility named by the utility operand with the modified environment.
Optional arguments are passed to utility. If no utility operand is specified, the resulting environment is written to the standard output, with one name=value pair per line.
If env executes commands with arguments, it uses the default shell /usr/bin/sh (see sh(1)).
If env executes commands with arguments, it uses /usr/xpg4/bin/sh (see ksh88(1)).
The following options are supported:
Ignores the environment that would otherwise be inherited from the current shell. Restricts the environment for utility to that specified by the arguments.
The following operands are supported:
Arguments of the form name=value modify the execution environment, and are placed into the inherited environment before utility is invoked.
The name of the utility to be invoked. If utility names any of the special shell built-in utilities, the results are undefined.
A string to pass as an argument for the invoked utility.
Example 1 Invoking utilities with new PATH values
The following utility:
example% env -i PATH=/mybin mygrep xyz myfile
invokes the utility mygrep with a new PATH value as the only entry in its environment. In this case, PATH is used to locate mygrep, which then must reside in /mybin.
See environ(5) for descriptions of the following environment variables that affect the execution of env: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Determine the location of the utility. If PATH is specified as a name=value operand to env, the value given shall be used in the search for utility.
If utility is invoked, the exit status of env is the exit status of utility. Otherwise, the env utility returns one of the following exit values:
Successful completion.
An error occurred.
utility was found but could not be invoked.
utility could not be found.
See attributes(5) for descriptions of the following attributes:
|
|
ksh88(1), sh(1), exec(2), profile(4), attributes(5), environ(5), standards(5)