From b10f2a2ec8dd99a6a4cebaad1dae444faafb853b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Mon, 10 Feb 2025 17:30:12 +0100 Subject: [PATCH] notes: add environment section --- NOTES.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/NOTES.md b/NOTES.md index d6aef6e..534ecf1 100644 --- a/NOTES.md +++ b/NOTES.md @@ -439,6 +439,23 @@ execution environment. A subshell is a copy of the shell process. +#### Environment +cf. 3.7.4 Environment + +When a program is invoked it is given an array of strings called the +"environment". This is a list of name-value pairs, of the form 'name=value'. + +Bash provides several ways to manipulate the environment. On invocation, the +shell scans its own environment and creates a parameter for each name found, +automatically marking it for 'export' to child processes. Executed commands +inherit the environment. The 'export' and 'unset' builtins allow parameters to +be added to and deleted from the environment. If the value of a parameter in +the environment is modified using the 'export' builtin, the new value becomes +part of the environment, replacing the old. The environment inherited by any +executed command consists of the shell's initial environment, whose values may +be modified in the shell, less any pairs removed by the 'unset' builtin, plus +any additions via the 'export' command. + ## Here Documents cf. Bash Reference Manual 3.6.6 Here Documents