The closing pattern accepted spaces and tabs around the delimiter for both forms, so a body line such as ' EOF' ended the message early. Bash ends <<EOF only at a line that is exactly EOF, and <<-EOF also after leading tabs. The body is now read line by line from the command, and the existing message pattern is back to what it was on main.