Can't parse command substitution containing here-document and pipeline

Bug #1855606 reported by Sam Kendall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mksh
Invalid
Undecided
Unassigned

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.

Revision history for this message
Thorsten Glaser (mirabilos) wrote :
Changed in mksh:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.