ksh vs ksh93 -- syntax error ... `(' unmatched.

x=$(cat <<EOF
Hi.
EOF)

print "$x"

If my shebang is "/bin/ksh" this print "Hi." If my shebang is /bin/ksh93 this errors with:

syntax error at line 3: `(' unmatched.

I guess my default ksh is ksh88.

So, I'm used to setting variables this way, allowing a complex command (that may involving logging into a database, or whatever) to get its input from the here document and to return a single value directly into a variable. But, I also need ksh93-specific functionality.

Recommendations?

My ksh93 outputs:

Hi.

Maybe this is an AIX thing.

try:

x=$(cat <<EOF
Hi.
EOF
)

That did it, Thanks.

Under my Linux ksh93 the original code works, with the closing parenthesis right after the EOF, but under AIX ksh93 it fails. The here document terminator should always be on a line by itself, though, so your change is definitely a correction, not a workaround.