Background: Unquoted heredocs are this construct cat <<EOF heredoc will expand $var, `cmd` etc EOF
Quoted heredocs are this construct: cat <<"EOF" these chars are literals: $ ` EOF "Quoteness" also can be achieved by bkslash or single quotes: EO\F 'EOF' EOF"" ''EOF The bug: if there are backquotes in eof-mark, they become the part of eof-makr (this is ok), but they also make this heredoc _quoted_, which should not happen: cat <<EO`true`F heredoc1 EO`false`F EO`true`F echo Ok:$? Output of bash-4.3.43: $ bash z heredoc1 EO`false`F Ok:0 Should be: heredoc1 EOF Ok:0