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
{{ message }}
Repository navigation
Parse error for $'\'' inside a command substitution #15
With unbash 5.1.0, an ANSI-C quoted string holding an escaped single quote parses fine on its own, but inside $( … ) the parser loses track of where the substitution ends.
echo $'\''; X → no errors, 2 commands
echo $(echo $'\''); X → "unterminated command substitution", 1 command
echo "$(echo $'\'')"; X → "unterminated double quote", "unterminated command substitution"
echo "$(echo $'a')"; X → no errors, 2 commands
Bash 5.3 runs the third line as written. It prints ' and then runs X. So the \' inside $'…' seems to be read as closing the string when it appears within a substitution.
Thanks for the report. I was working on v6 so this will be included in that major. Let me know if you need it in v5 and I might be able to backport a fix, but ideally you'd give main a shot (also see docs/MIGRATION-v5-to-v6.md). Also note that v6 introduces forEachChild which might be convenient for traversal.
Thanks for the quick fix! No need for a backport: my use fails closed on the parse error, so 5.1.0 is fine for now. We'll move to v6 when it's released. 'forEachChild' will let us drop our hand-written walker, and the elif and glob notes in the migration guide are exactly what I needed to know.
Activity
webpro commentedon Oct 15, 2026
Thanks for the report. I was working on v6 so this will be included in that major. Let me know if you need it in v5 and I might be able to backport a fix, but ideally you'd give main a shot (also see docs/MIGRATION-v5-to-v6.md). 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@db63c2bgit-m86 commentedon Oct 16, 2026
Thanks for the quick fix! No need for a backport: my use fails closed on the parse error, so 5.1.0 is fine for now. We'll move to v6 when it's released. 'forEachChild' will let us drop our hand-written walker, and the elif and glob notes in the migration guide are exactly what I needed to know.
webpro commentedon Oct 16, 2026
🚀 This issue has been resolved in v6.0.0. See Release 6.0.0 for release notes.
Handle ANSI-C quotes in command substitutions (resolve webpro-nl#15)