Public bug reported:
This scriptlet, boiled down from production code, fails with "syntax
error: '|' unexpected":
a=$(cat <<EOF | cat
hello
EOF
)
[ "$a" = hello ]
The following variation fails in the same way:
a=$(cat <<EOF |
hello
EOF
cat
)
[ "$a" = hello ]
Those scriptlets work in ksh93, ksh88 (AIX and Solaris), bash, and even
pdksh 5.2.14 (RHEL 4). I've reproduced the failures in mksh R56 (RHEL 8)
and R46 (RHEL 7).
It's the combination of $( ), here-document, and pipeline that provokes
the bug. Take away one of those elements, and there's no trouble.
** Affects: mksh
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1855606
Title:
Can't parse command substitution containing here-document and pipeline
Status in mksh:
New
Bug description:
This scriptlet, boiled down from production code, fails with "syntax
error: '|' unexpected":
a=$(cat <<EOF | cat
hello
EOF
)
[ "$a" = hello ]
The following variation fails in the same way:
a=$(cat <<EOF |
hello
EOF
cat
)
[ "$a" = hello ]
Those scriptlets work in ksh93, ksh88 (AIX and Solaris), bash, and
even pdksh 5.2.14 (RHEL 4). I've reproduced the failures in mksh R56
(RHEL 8) and R46 (RHEL 7).
It's the combination of $( ), here-document, and pipeline that
provokes the bug. Take away one of those elements, and there's no
trouble.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1855606/+subscriptions