10. Diagnostics and Workflow
Lash tries to fail before Bash runs when a problem can be found statically.
Check first
lash check script.lash
check runs preprocessing, parsing, semantic analysis, warnings, and codegen feasibility checks without writing or running Bash output.
Run and compile
lash run script.lash arg1 arg2
lash compile script.lash -o script.sh
bash script.sh
run compiles to temporary Bash and executes it. compile writes the Bash output so you can inspect or run it yourself.
Format and watch
lash format .
lash format . --check
lash watch script.lash
lash watch src/
Use format --check in CI and watch when iterating on scripts.
Diagnostic groups
Diagnostic codes are grouped by phase:
E000-E001: lexing and parsingE010-E015: preprocessor errorsE110-E125: names, declarations, scope, traps, enums, andintoE200-E203: type and container compatibilityE300-E303: flow and constant-safety checksE400-E401: code generation feasibilityW010,W500-W522: warnings
Common warnings
Warnings include:
- unreachable statements
- unused variables, parameters, and functions
- shadowed variables
- constant conditions
- suspicious missing interpolation
- malformed shell expansions
- suspicious heredoc payloads
wait jobswith no tracked jobs- non-positive constant
waittargets - missing or malformed shebangs
Warnings are there to make shell scripts less surprising. Treat them as design feedback, especially in automation code.
A useful debugging loop
- Run
lash check. - Fix the first real error.
- Re-run
lash check. - If generated Bash behavior is surprising, run
lash compileand inspect the output. - Use
--verboseon CLI commands when you need phase and tool resolution details.