Skip to main content

Module bash

Module bash 

Source
Expand description

The Bash shell implementation. The Bash shell implementation.

The Shell layer is split into a shared execution core (ShellCore) and per-shell shells. Bash is one of them: it owns its grammar (via brush_parser), its builtin table, and its dialect (messages and prompt). Builtins it shares with Zsh delegate to core mechanisms only where the two shells were verified to behave identically (cd, pwd, jobs, fg, bg, hash, dirs, pushd, popd, unset, source, clear); anything with different semantics (echo, export, alias, type) is implemented here.

Parsing uses the brush_parser crate — the tokenizer and AST parser from the brush-shell project — so shell grammar (quoting, operators, pipelines, compound commands) is real grammar, not a hand-rolled approximation.

Supported compound constructs: if/elif/else, while/until, brace groups, subshells (isolated session state), for iteration, case clauses, arithmetic ($(( )) and (( )), sharing one evaluator with the expander), function definitions, and [[ ]] extended tests. Arrays are not supported yet.

Structs§

Bash
The Bash shell.
BashInterpreter
The behavior of /bin/sh and /bin/bash: the Bash dialect as a program. Scripts and sh -c invocations run through the same implementation as interactive commands.