Skip to content

Files

Latest commit

 

History

History
31 lines (20 loc) · 737 Bytes

SC1041.md

File metadata and controls

31 lines (20 loc) · 737 Bytes

Pattern: Improperly terminated here-document

Issue: -

Description

Your here-document isn't properly terminated.

Look at here-document and see which line was supposed to terminate it. Then ensure it matches the token exactly, and that it's on its own line with no text before or after.

Example of incorrect code:

cat <<-eof
Hello World
-eof

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.

Example of correct code:

cat <<- eof
Hello World
eof

Further Reading