Principle:20000419 Fauxnix Bash Argv Contract
| Knowledge Sources | |
|---|---|
| Domains | Facade, Bash_Argv_Contract, Shell_Semantics |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
A process-contract emulation technique that makes a non-bash executable behave like bash from the caller's perspective: accepting -c/-lc/-l -c option combinations, reporting the GNU bash version line, setting $0/$1.. from trailing operands, and supporting a persistent marker-session protocol over stdin.
Description
The Bash Argv Contract is what lets Claude Code's built-in Bash tool call fauxnix's bash.exe launcher without knowing it is not real bash. The facade parses the argv as bash would: -c (and -e) consume the next token as the script; -l/-i/-s/-r are accepted and ignored (login/interactive/read/std-restricted modes); options may combine (-lc) and appear between flags; -- separates options from operands. --version prints the GNU bash version line (with a fauxnix disclosure suffix). Trailing operands set $0 (and $1.. via set --). When no -c is given, the facade enters a persistent marker session: stdin chunks wrapped in <bash-input>...</bash-input> are each executed in the resident session and answered with output plus a <bash-exit>N</bash-exit> line. Exit codes follow bash (2 for syntax errors, 127 for not-found).
Usage
Use this principle when a tool must impersonate a shell binary to a harness that invokes shells by path. The full argv-contract emulation (options, version, positionals, marker session) is the right choice when the harness's invocation patterns are captured from a real session and must be matched exactly.
Theoretical Basis
parseDashC(argv):
wantScript = false; script = undefined; positionals = []
for each token:
if token starts with '-' (and no script yet):
for each char: 'c'/'e' → wantScript=true; 'l'/'i'/'s'/'r' → ignore; else → reject
elif wantScript and script undefined: script = token
else: positionals.push(token)
if not wantScript: return null → marker session
runFacade:
--version → print VERSION_LINE; return 0
dashC → runOneShot (set $0/$1.., run script) or tryClaudeCodeAdapter
no -c → runMarkerSession (stdin <bash-input> blocks)