Skip to content

feat(builtins): implement expr builtin#266

Merged
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD
Feb 25, 2026
Merged

feat(builtins): implement expr builtin#266
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Feb 25, 2026

Summary

  • Add expr builtin supporting arithmetic (+, -, *, /, %), comparison (=, !=, <, >, <=, >=), string operations (length, substr, index, match), and pattern matching (: operator)
  • Handle exit codes per POSIX: 0 for truthy results, 1 for zero/empty results, 2 for errors
  • 13 spec tests covering arithmetic, string ops, comparisons, pattern matching, error cases, and exit code semantics

Test plan

  • cargo clippy --all-targets --all-features -- -D warnings passes
  • cargo test --all-features --test spec_tests bash_spec_tests passes
  • All 13 expr spec tests pass
  • Spec counts updated (Bash 971, Total 1389)

Add expr command supporting arithmetic (+, -, *, /, %), comparison
(=, !=, <, >, <=, >=), string operations (length, substr, index,
match), and pattern matching with : operator.

13 spec tests covering positive and negative cases.
@chaliy chaliy merged commit 88177b6 into main Feb 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants