Machine Type: i386-redhat-linux-gnu
Bash Version: 4.0
Patch Level: 23
Release Status: release
Description:
Bash 4.0 errors on a here-document enclosed in $(). For example:
x=$(cat <<EOF
foo
bar
EOF)
Ctrl+D
-bash: unexpected EOF while looking for matching `)'
-bash: syntax error: unexpected end of file
Repeat-By:
Save the following script in a file named t.sh, execute the file
and observe the parse error:
./t.sh: line 7: unexpected EOF while looking for matching `)'
./t.sh: line 13: syntax error: unexpected end of file
#!/bin/bash
x=`cat <<EOF
foo
bar
EOF`
y=$(cat <<EOF
foo
bar
EOF)
[ "$x" != "$y" ] && exit 1