# Bash v0.6.0 - Table of Contents

A Bash interpreter written in pure Elixir with compile-time parsing, session management, and Elixir interop

## Pages

- [LICENSE](license.md)
- [Architecture Guide](architecture.md)

## Modules

- Core API
  - [Bash](Bash.md): 
  - [Bash.Filesystem](Bash.Filesystem.md): Behaviour and dispatcher for pluggable filesystem implementations.
  - [Bash.Filesystem.ETS](Bash.Filesystem.ETS.md): In-memory filesystem implementation backed by an ETS table.
  - [Bash.Filesystem.LocalDisk](Bash.Filesystem.LocalDisk.md): Default filesystem implementation that delegates to the host OS filesystem.
  - [Bash.Formatter](Bash.Formatter.md): Mix formatter plugin for Bash scripts and sigils.
  - [Bash.Script](Bash.Script.md): Top-level script: a sequence of statements with separators.
  - [Bash.Session](Bash.Session.md): Session GenServer for maintaining Bash execution context.
  - [Bash.Sigil](Bash.Sigil.md): Sigil implementation for `~BASH`.
  - [Bash.Telemetry](Bash.Telemetry.md): Telemetry instrumentation for the Bash interpreter.

- Elixir Interop
  - [Bash.Context](Bash.Context.md): Unified execution context for `defbash` functions in both builtins and interop.
  - [Bash.Interop](Bash.Interop.md): Define Elixir functions callable from Bash scripts.
  - [Bash.Interop.Result](Bash.Interop.Result.md): Normalized result from an Elixir interop function call.

- Parsing
  - [Bash.Parser](Bash.Parser.md): Recursive descent parser for Bash scripts.
  - [Bash.Parser.Arithmetic](Bash.Parser.Arithmetic.md): Parser for bash arithmetic expressions.
  - [Bash.Parser.VariableExpander](Bash.Parser.VariableExpander.md): Hand-written parser and expander for Bash variable expansions.
  - [Bash.Tokenizer](Bash.Tokenizer.md): Lexer for Bash syntax.

- AST Nodes
  - [Bash.AST](Bash.AST.md): Typed Abstract Syntax Tree (AST) for Bash.
  - [Bash.AST.Arithmetic](Bash.AST.Arithmetic.md): Arithmetic expression for (( ... )) constructs.
  - [Bash.AST.ArrayAssignment](Bash.AST.ArrayAssignment.md): Array assignment statement.
  - [Bash.AST.Assignment](Bash.AST.Assignment.md): Variable assignment.
  - [Bash.AST.BraceExpand](Bash.AST.BraceExpand.md): Brace expansion AST node.
  - [Bash.AST.Case](Bash.AST.Case.md): Case statement: pattern matching.
  - [Bash.AST.Command](Bash.AST.Command.md): Simple command: name with arguments and optional redirections.
  - [Bash.AST.Comment](Bash.AST.Comment.md): Comment for # ... constructs.
  - [Bash.AST.Compound](Bash.AST.Compound.md): Compound statement: subshell or command group.
  - [Bash.AST.Coproc](Bash.AST.Coproc.md): Coproc AST node.
  - [Bash.AST.ForLoop](Bash.AST.ForLoop.md): for NAME [in WORDS ... ] ; do COMMANDS; done
  - [Bash.AST.Function](Bash.AST.Function.md): Function definition.
  - [Bash.AST.If](Bash.AST.If.md): Conditional statement: if/elif/else/fi.
  - [Bash.AST.Meta](Bash.AST.Meta.md): Source location metadata attached to every AST node.
Used for error reporting, debugging, and execution tracking.
  - [Bash.AST.Pipeline](Bash.AST.Pipeline.md): Pipeline: sequence of commands connected by pipes (|).
  - [Bash.AST.Redirect](Bash.AST.Redirect.md): I/O redirection.
  - [Bash.AST.RegexPattern](Bash.AST.RegexPattern.md): Regex pattern for use with the `=~` operator in `[[ ]]` test expressions.
  - [Bash.AST.TestCommand](Bash.AST.TestCommand.md): Test command for [ ... ] conditional constructs.
  - [Bash.AST.TestExpression](Bash.AST.TestExpression.md): Test expression for [[ ... ]] conditional constructs.
  - [Bash.AST.Variable](Bash.AST.Variable.md): Variable reference with optional parameter expansion operators.
  - [Bash.AST.Walkable](Bash.AST.Walkable.md): Protocol for traversing and transforming AST nodes.
  - [Bash.AST.WhileLoop](Bash.AST.WhileLoop.md): While or until loop.
  - [Bash.AST.Word](Bash.AST.Word.md): Word: expandable text that may contain variables, command substitutions, etc.
  - [Bash.Statement](Bash.Statement.md): Type definition for executable Bash statements.

- Execution
  - [Bash.Arithmetic](Bash.Arithmetic.md): Evaluates bash arithmetic expressions.
  - [Bash.CommandPolicy](Bash.CommandPolicy.md): Policy engine for controlling command execution and filesystem access.
  - [Bash.CommandPort](Bash.CommandPort.md): Single interface for all user-facing OS process execution.
  - [Bash.CommandResult](Bash.CommandResult.md): Represents the result of executing a command.
  - [Bash.Execution](Bash.Execution.md): Represents a single command execution with its own I/O streams.
  - [Bash.ExecutionResult](Bash.ExecutionResult.md): Protocol for extracting execution results from various result types.
  - [Bash.Executor](Bash.Executor.md): Executes parsed Bash AST nodes within session context.
  - [Bash.OrphanSupervisor](Bash.OrphanSupervisor.md): GenServer for managing orphaned/disowned jobs.
  - [Bash.Pipe](Bash.Pipe.md): BEAM-native pipe that buffers data between a writer and reader using
blocked `GenServer.call/3`.
  - [Bash.ProcessSubst](Bash.ProcessSubst.md): GenServer managing process substitution execution.
  - [Bash.Sink](Bash.Sink.md): Output sink functions for streaming command output.
  - [Bash.Variable](Bash.Variable.md): Bash variable with attributes and value.
Supports scalar values, indexed arrays, and associative arrays.

- Job Control
  - [Bash.Job](Bash.Job.md): Represents a background job in a Bash session.
  - [Bash.JobProcess](Bash.JobProcess.md): GenServer wrapping a background OS process.
  - [Bash.Session.ExecRef](Bash.Session.ExecRef.md): Opaque handle to an in-flight execution.

- Builtins
  - [Bash.Builtin](Bash.Builtin.md): Central registry for Bash builtin commands and reserved words.
  - [Bash.Builtin.Alias](Bash.Builtin.Alias.md): `alias [-p] [name[=value] ... ]`
  - [Bash.Builtin.Bg](Bash.Builtin.Bg.md): `bg [job_spec ...]`
  - [Bash.Builtin.Break](Bash.Builtin.Break.md): `break [n]`
  - [Bash.Builtin.Builtin](Bash.Builtin.Builtin.md): `builtin [shell-builtin [arg ...]]`
  - [Bash.Builtin.Caller](Bash.Builtin.Caller.md): `caller [EXPR]`
  - [Bash.Builtin.Cd](Bash.Builtin.Cd.md): `cd [-L|-P] [dir]`
  - [Bash.Builtin.Colon](Bash.Builtin.Colon.md): Null command.
  - [Bash.Builtin.Command](Bash.Builtin.Command.md): `command [-pVv] command [arg ...]`
  - [Bash.Builtin.Complete](Bash.Builtin.Complete.md): `complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]`
  - [Bash.Builtin.Continue](Bash.Builtin.Continue.md): `continue [n]`
Resume for, while, or until loops.
  - [Bash.Builtin.Coproc](Bash.Builtin.Coproc.md): `coproc [NAME] command [redirections]`
  - [Bash.Builtin.Declare](Bash.Builtin.Declare.md): `declare [-afFirtx] [-p] [name[=value] ...]`
  - [Bash.Builtin.Dirs](Bash.Builtin.Dirs.md): `dirs [-clpv] [+N] [-N]`
Display directory stack.
  - [Bash.Builtin.Disown](Bash.Builtin.Disown.md): `disown [-h] [-ar] [jobspec ... | pid ...]`
  - [Bash.Builtin.Echo](Bash.Builtin.Echo.md): `echo [-neE] [arg ...]`
  - [Bash.Builtin.Enable](Bash.Builtin.Enable.md): `enable [-a] [-dnps] [-f filename] [name ...]`
  - [Bash.Builtin.Eval](Bash.Builtin.Eval.md): `eval [arg ...]`
  - [Bash.Builtin.Exec](Bash.Builtin.Exec.md): `exec [-cl] [-a name] [command [argument ...]]`
  - [Bash.Builtin.Exit](Bash.Builtin.Exit.md): `exit [n]`
  - [Bash.Builtin.Export](Bash.Builtin.Export.md): `export [-fn] [name[=value] ...] or export -p [-f]`
Set export attribute for shell variables.
  - [Bash.Builtin.False](Bash.Builtin.False.md): Return an unsuccessful result.
  - [Bash.Builtin.Fc](Bash.Builtin.Fc.md): `fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [cmd]`
  - [Bash.Builtin.Fg](Bash.Builtin.Fg.md): `fg [job_spec]`
  - [Bash.Builtin.Getopts](Bash.Builtin.Getopts.md): `getopts optstring name [arg]`
  - [Bash.Builtin.Hash](Bash.Builtin.Hash.md): `hash [-lr] [-p pathname] [-dt] [name ...]`
  - [Bash.Builtin.Help](Bash.Builtin.Help.md): `help [-dms] [pattern ...]`
  - [Bash.Builtin.History](Bash.Builtin.History.md): `history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]`
  - [Bash.Builtin.Jobs](Bash.Builtin.Jobs.md): `jobs [-lnprs] [jobspec ...] or jobs -x command [args]`
  - [Bash.Builtin.Kill](Bash.Builtin.Kill.md): `kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]`
  - [Bash.Builtin.Let](Bash.Builtin.Let.md): `let arg [arg ...]`
`(( expression ))`
  - [Bash.Builtin.Local](Bash.Builtin.Local.md): `local [option] name[=value] ...`
  - [Bash.Builtin.Mapfile](Bash.Builtin.Mapfile.md): `mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]`
  - [Bash.Builtin.Popd](Bash.Builtin.Popd.md): `popd [-n] [+N | -N]`
Remove entries from the directory stack.
  - [Bash.Builtin.Printf](Bash.Builtin.Printf.md): `printf [-v var] format [arguments]`
  - [Bash.Builtin.Pushd](Bash.Builtin.Pushd.md): `pushd [-n] [dir | +N | -N]`
Add directories to the directory stack.
  - [Bash.Builtin.Pwd](Bash.Builtin.Pwd.md): `pwd [-LP]`
  - [Bash.Builtin.Read](Bash.Builtin.Read.md): `read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]`
  - [Bash.Builtin.Readonly](Bash.Builtin.Readonly.md): `readonly [-aAf] [name[=value] ...] or readonly -p`
  - [Bash.Builtin.Return](Bash.Builtin.Return.md): `return [n]`
  - [Bash.Builtin.Set](Bash.Builtin.Set.md): `set [--abefhkmnptuvxBCHP] [-o option] [arg ...]`
  - [Bash.Builtin.Shift](Bash.Builtin.Shift.md): `shift [n]`
  - [Bash.Builtin.Shopt](Bash.Builtin.Shopt.md): `shopt [-pqsu] [-o] [optname ...]`
  - [Bash.Builtin.Source](Bash.Builtin.Source.md): `source filename [arguments]`
  - [Bash.Builtin.Suspend](Bash.Builtin.Suspend.md): `suspend [-f]`
  - [Bash.Builtin.Test](Bash.Builtin.Test.md): `test [expr]`
  - [Bash.Builtin.TestCommand](Bash.Builtin.TestCommand.md): Implementation of the POSIX test builtin.
  - [Bash.Builtin.Times](Bash.Builtin.Times.md): `times`
  - [Bash.Builtin.Trap](Bash.Builtin.Trap.md): `trap [-lp] [arg signal_spec ...]`
  - [Bash.Builtin.True](Bash.Builtin.True.md): Return a successful result.
  - [Bash.Builtin.Type](Bash.Builtin.Type.md): `type [-afptP] name [name ...]`
  - [Bash.Builtin.Ulimit](Bash.Builtin.Ulimit.md): `ulimit [-SHacdfilmnpqstuvx] [limit]`
  - [Bash.Builtin.Umask](Bash.Builtin.Umask.md): `umask [-p] [-S] [mode]`
  - [Bash.Builtin.Unalias](Bash.Builtin.Unalias.md): `unalias [-a] name [name ...]`
  - [Bash.Builtin.Unset](Bash.Builtin.Unset.md): `unset [-fvn] [name ...]`
  - [Bash.Builtin.Unsupported](Bash.Builtin.Unsupported.md): Handler for builtins that are not supported in this implementation.
  - [Bash.Builtin.Wait](Bash.Builtin.Wait.md): `wait [n ...]`

- Exceptions
  - [Bash.EscapeError](Bash.EscapeError.md): Exception raised when a string cannot be safely escaped for a Bash context.
  - [Bash.SyntaxError](Bash.SyntaxError.md): Exception raised when bash script parsing or validation fails.

## Mix Tasks

- [mix bash.format](Mix.Tasks.Bash.Format.md): Formats Bash script files.
- [mix bash.validate](Mix.Tasks.Bash.Validate.md): Validates Bash script files for syntax errors.

