bash: Environment
1
1 3.7.4 Environment
1 -----------------
1
1 When a program is invoked it is given an array of strings called the
1 ENVIRONMENT. This is a list of name-value pairs, of the form
1 'name=value'.
1
1 Bash provides several ways to manipulate the environment. On
1 invocation, the shell scans its own environment and creates a parameter
1 for each name found, automatically marking it for EXPORT to child
1 processes. Executed commands inherit the environment. The 'export' and
1 'declare -x' commands allow parameters and functions to be added to and
1 deleted from the environment. If the value of a parameter in the
1 environment is modified, the new value becomes part of the environment,
1 replacing the old. The environment inherited by any executed command
1 consists of the shell's initial environment, whose values may be
1 modified in the shell, less any pairs removed by the 'unset' and 'export
1 -n' commands, plus any additions via the 'export' and 'declare -x'
1 commands.
1
1 The environment for any simple command or function may be augmented
1 temporarily by prefixing it with parameter assignments, as described in
1 ⇒Shell Parameters. These assignment statements affect only the
1 environment seen by that command.
1
1 If the '-k' option is set (⇒The Set Builtin), then all
1 parameter assignments are placed in the environment for a command, not
1 just those that precede the command name.
1
1 When Bash invokes an external command, the variable '$_' is set to
1 the full pathname of the command and passed to that command in its
1 environment.
1