Expand description
What a shell is: which bash, how it was given its code, and what it had switched on when it joined.
A shell’s own account of itself, read back from the words it wrote. Nothing
is inferred from the shape of what it went on to say — bash reports one word
for several different things, main standing for a script’s top level in
FUNCNAME, an interactive prompt in BASH_SOURCE, and any function a
subject cares to name that way.
Bash and what it holds are description alone. Shell pairs that with
where the shell sits in the run.
Structs§
- Bash
- Which bash a shell is, and how it was started. Constant for as long as the shell lives — a fork inherits it, and anything that could change it makes a new shell instead.
- Flags
$-, as bash wrote it.- Invocation
- How bash was given the code it runs.
setrefuses-i,-cand-s, so all three are settled when the shell starts and cannot have changed by the time anything reads them. - Options
- What a shell had switched on at the moment it said so. A snapshot: a subject
may
set -eat any point. - Shell
- A shell in a run: which bash it is, where it sits, and what it had switched on when it joined.
- Version
$BASH_VERSINFO, all six elements. What bash behaves like is a function of this, so a reading that has to bend for an older shell has what it needs.