ksh with input redirection in conjunction with pipes leads to syntax error `here-document not contained within command substitution`

Solution In Progress - Updated -

Issue

Following script

#!/bin/ksh
#
cat <<EOF | echo $(hostname)
qwerty
EOF

fails with message:

ksh: syntax error at line 3:  `'<<EOF' here-document not contained within command substitution`

Environment

  • Red Hat Enterprise Linux (RHEL) 6.4 and 6.5
  • ksh-20120801-10.el6
  • ksh-20100621-19.el6_4.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content