cat <<-eof
Hello World
-eof
cat <<- eof
Hello World
eof
Your here document isn't properly terminated. There is a line containing the terminator you've chosen, but it's not by itself on a separate line.
In the example code, the script uses <<-eof
, which is the operator <<-
followed by eof
.
The script therefore looks for eof
and skips right past the intended terminator because it starts with a dash.
It is recommended to look at your here document and see which line was supposed to terminate it and ensure it matches the token exactly, and that it's on its own line with no text before or after.
Under Windows the error might occur due to the standard CRLF
line-ending, which is Windows-specific. Try to change the line ending into LF
.