Skip to content

Comments

feat(builtins): implement shopt builtin with nullglob enforcement#254

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

feat(builtins): implement shopt builtin with nullglob enforcement#254
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 24, 2026

Summary

  • Add shopt builtin for bash-specific shell options (-s, -u, -q, -p flags)
  • All standard bash shopt option names recognized (extglob, nullglob, globstar, etc.)
  • Enforce nullglob behavior: unmatched globs expand to nothing when enabled
  • nullglob applied in command args, for loops, and select loops

Test plan

  • 8 spec tests covering set/unset/query/print/invalid options/nullglob behavior
  • All existing tests pass
  • cargo clippy clean, cargo fmt clean

Add the shopt builtin for bash-specific shell options:
- shopt -s/-u for setting/unsetting options
- shopt -q for quiet query (exit code only)
- shopt -p for reusable output format
- All standard bash shopt option names recognized
- Options stored as SHOPT_<name> variables

Enforce nullglob behavior: when SHOPT_nullglob is set, unmatched glob
patterns expand to nothing instead of keeping the literal pattern.
Applied in command args, for loops, and select loops.

8 spec tests + updated builtin count to 94 core (97 total).
@chaliy chaliy merged commit ca21002 into main Feb 24, 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