JustBash.Interpreter.Executor.Conditional (JustBash v0.4.0)
View SourceEvaluates conditional expressions for [[ ]] and if statements.
Supports:
- Unary file tests: -e, -f, -d, -r, -w, -x, -s, -L, -h, etc.
- Unary string tests: -z, -n
- Binary string comparisons: =, ==, !=, <, >
- Binary integer comparisons: -eq, -ne, -lt, -le, -gt, -ge
- Binary file comparisons: -nt, -ot, -ef
- Pattern matching: ==, =~
- Logical operators: &&, ||, !
Summary
Functions
Evaluate a conditional expression AST node.
Returns {result, updated_bash} where result is true or false.
The bash struct may be updated (e.g. BASH_REMATCH after =~).
Types
Functions
@spec evaluate(JustBash.t(), JustBash.AST.conditional_expression()) :: {boolean(), JustBash.t()}
Evaluate a conditional expression AST node.
Returns {result, updated_bash} where result is true or false.
The bash struct may be updated (e.g. BASH_REMATCH after =~).