You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a limitation of the parser. It marks only {foo,bar} as brace expansion. But this is part of the glob patterns. It would be nice if all glob patterns were marked as globs. So it's easier to handle.
Right now I use regular expressions to check Word::text and for BraceExpansion I just return text because it's part of the glob expansion handled in a different place.
Bash itself does not treat braces as pattern syntax. Brace expansion is a separate, purely textual step that runs before globbing: *.{js,ts} becomes the two words *.js and *.ts, and only then is each matched against the filesystem. nullglob leaves {foo,bar} alone, and in a case pattern or [[ x == {foo,bar} ]] the braces are literal characters. JS glob libraries fold brace expansion into matching, which makes the two look like one feature, but the Literal plus BraceExpansion split is what bash does.
Marking unquoted *, ? and [...] is a separate request, and a fair one. Extglob groups like @(a|b) are already ExtendedGlob parts, but plain glob characters are ordinary text: inside a structured word they sit in Literal parts, and a word like foo* has no parts at all because it never leaves the plain-word fast path. A glob part adds a check to that fast path for every word, so it needs measuring first.
You can already narrow the regexes, though: quoted parts never glob, and text keeps the backslash that value drops, both on parts and on a word without parts.
Would a part for unquoted *, ? and [...], like ShellCheck's T_Glob, cover your case, with your glob library still handling the braces?
This took a while as it's a breaking change, so it's coming in v6. Feel free to explore docs/MIGRATION-v5-to-v6.md and give main a shot if you're up for it. Also note that v6 introduces forEachChild which might be convenient for traversal.
Activity
webpro commentedon Oct 8, 2026
Bash itself does not treat braces as pattern syntax. Brace expansion is a separate, purely textual step that runs before globbing:
*.{js,ts}becomes the two words*.jsand*.ts, and only then is each matched against the filesystem.nullglobleaves{foo,bar}alone, and in acasepattern or[[ x == {foo,bar} ]]the braces are literal characters. JS glob libraries fold brace expansion into matching, which makes the two look like one feature, but theLiteralplusBraceExpansionsplit is what bash does.Marking unquoted
*,?and[...]is a separate request, and a fair one. Extglob groups like@(a|b)are alreadyExtendedGlobparts, but plain glob characters are ordinary text: inside a structured word they sit inLiteralparts, and a word likefoo*has nopartsat all because it never leaves the plain-word fast path. A glob part adds a check to that fast path for every word, so it needs measuring first.You can already narrow the regexes, though: quoted parts never glob, and
textkeeps the backslash thatvaluedrops, both on parts and on a word withoutparts.Would a part for unquoted
*,?and[...], like ShellCheck'sT_Glob, cover your case, with your glob library still handling the braces?jcubic commentedon Oct 8, 2026
If braces are a different thing, it's ok to make them separate. I think that I can handle both using same glob library.
webpro commentedon Oct 15, 2026
This took a while as it's a breaking change, so it's coming in v6. Feel free to explore docs/MIGRATION-v5-to-v6.md and give main a shot if you're up for it. Also note that v6 introduces forEachChild which might be convenient for traversal.
webpro commentedon Oct 15, 2026
Preview releases are available, e.g.
npm i https://pkg.pr.new/unbash@db63c2bwebpro commentedon Oct 16, 2026
🚀 This issue has been resolved in v6.0.0. See Release 6.0.0 for release notes.
Add structured glob word parts (resolve webpro-nl#13)