2 SC1120
koalaman edited this page 2017-07-08 14:52:25 -07:00

No comments allowed after here-doc token. Comment the next line instead.

Problematic code:

cat << eof  # --- Start greeting --
Hello
eof         # --- End greeting ---

Correct code:

cat << eof  # --- Start greeting --
Hello
eof
            # --- End greeting ---

Rationale:

The terminator token for a here document must be on an entirely separate line. No comments are allowed on this line.

Place the comment somewhere else, such as on the following line.

Exceptions:

None