Skip to content

syntax: support alternate command substitution of Bash 5.3 inside double quotes #1368

Closed

Description

@KorneiDontsov

PR #1178 added the initial support for the "subshell-less" command substitutions introduced in Bash 5.3: ${ command; } and ${| command; }.

However, when these command substitutions are put inside double quotes, they cause errors.

#!/usr/bin/env bash
# test.sh
x="${ echo 1;}"
echo "$x"
$ shfmt test.sh
test.sh:4:9: reached EOF without closing quote `"`
#!/usr/bin/env bash
# test2.sh
x="${| REPLY=1;}"
echo "$x"
$ shfmt test.sh
test2.sh:4:9: reached EOF without closing quote `"`

Both scripts are valid and print 1 to the output.

Activity

  1. amas127 commented on Aug 13, 2026

    @amas127

    #1176 (comment)

    Thanks for putting forward this issue again! I would love to replace my "subshell" commands with their "subshell-less" ones, but shfmt currently just fails. I love shfmt, and if we could add this feature I am pretty sure it would be more consistent and lovely. It might be done with some simple patches, as seen in #1379.

  2. mvdan commented on Aug 13, 2026

    @mvdan
    Owner

    Thanks, I'll take a look. Indeed it's best not to report problems on closed issues, as they are easy to miss or forget.

  3. added a commit that references this issue on Aug 13, 2026
    a04df9f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址