Am 27.11.2016 um 18:51 schrieb Eduardo Bustamante: > Hi Alexey, > > Please read the specification of here-documents in the standard: > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04 > > Quoting the relevant parts: > > The here-document shall be treated as a single word that begins > after the next <newline> and continues until there is a line > containing only the delimiter and a <newline>, with no <blank> > characters in between. Then the next here-document starts, if there is > one. [...] > > [n]<<word > here-document > delimiter > > Delimiter (in your case the three character string "EOF"), has to be > on its own line, with no leading or trailing blanks (or any other > characters). If bash 3.x used to behave different, it's because it was > buggy. > > Hence, the proper way to do a here-document inside command substitution:
My understanding was that he is referring to the strange behavior in case of a malformed syntax. Why is "baz" output at all then? -- Reuti > > hp% cat hd > export foo=$(cat <<EOF > echo bar > EOF > ) > echo baz > hp% bash hd > baz >