env is a shell command that either reports environment variables or runs a command in a subprocess with modified environment variables. The command is provided in a Unix-like system.
via Wikipedia infobox
The env utility shall obtain the current environment, modify it according to its arguments, then invoke the utility named by the utility operand with the modified environment. If no utility operand is specified, the resulting environment shall be written to the standard output, with one name = value pair per line. The env utility shall conform to XBD Utility Syntax Guidelines , except for the unspecified usage of '-'. Invoke utility with exactly the environment specified by the arguments; the inherited environment shall be ignored completely. Arguments of the form name = value shall modify the execution environment, and shall be placed into the inherited environment before the utility is invoked. The name of the utility to be invoked. If the utility operand names any of the special built-in utilities in Special Built-In Utilities , the results are undefined. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( If the utility operand is specified, the env utility shall not write to standard output. The utility specified by utility was found but could not be invoked. The command , env , nice , nohup , time , and xargs utilities have been specified to use exit code 127 if an error occurs so that applications can distinguish "failure to find a utility" from "invoked utility exited with an error indication". The value 127 was chosen because it is not commonly used for other meanings; most utilities use small values for "normal error conditions" and the values above 128 can be confused with termination due to receipt of a signal. The value 126 was chosen in a similar manner to indicate that the utility could be found, but not invoked. Some scripts produce meaningful error messages differentiating the 126 and 127 cases. The distinction between exit codes 126 and 127 is based on KornShell practice that uses 127 when all attempts to exec the utility fail with [ENOENT], and uses 126 when any attempt to exec the utility fails for any other reason. Historical implementations of the env utility use the execvp () or execlp () functions defined in the System Interfaces volume of POSIX.1-2017 to invoke the specified utility; this provides better performance and keeps users from having to escape characters with special meaning to the shell. Therefore, shell functions, special built-ins, and built-ins that are only provided by the shell are not found. As with all other utilities that invoke other utilities, this volume of POSIX.1-2017 only specifies what env does with standard input, standard output, standard error, input files, and output files. If a utility is executed, it is not constrained by the specification of input and output by env . unalias -a Unset all possible aliases. Note that unalias is escaped to prevent an alias being used for unalias. This step is not strictly necessary, since aliases are not inherited, and the ENV environment variable is only used by interactive shells, the only way any aliases can exist in a script is if it defines them itself. unset -f env getconf Ensure env and getconf are not user functions. The example is equivalent to env when an environment variable is being added to the environment of the command, but not when the environment is being set to the given value. The env utility also writes out the current environment if invoked without arguments. There is sufficient functionality beyond what the example provides to justify inclusion of env . Austin Group Interpretati
~3 min read
env is a shell command that either reports environment variables or runs a command in a subprocess with modified environment variables. The command is provided in a Unix-like system.
By default, a subprocess inherits the environment variables of the parent process. env supports adding, modifying and removing the copied variables. env can also be used to launch the correct interpreter. In this usage, the environment is typically not changed. The command does not modify environment variables in the process in which it runs. Mechanisms for doing so include the command and assigning a name to a value like .
Excerpt from a page describing this subject · 10,952 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).