Skip to content

Files

Latest commit

 

History

History
37 lines (24 loc) · 922 Bytes

SC1119.md

File metadata and controls

37 lines (24 loc) · 922 Bytes

Pattern: Missing newline between end token and terminating )

Issue: -

Description

When embedding a here-document in $(..) or (..), there needs to be a linefeed (newline) between the document token and the closing ). Please insert one.

Failing to do so may cause warnings like this:

bash: warning: here-document at line 15 delimited by end-of-file (wanted `eof')`
dash: 5: Syntax error: end of file unexpected (expecting ")")

Example of incorrect code:

var=$(fmt -s "$COLUMNS" << "eof"
This is a bunch of text
eof)

Example of correct code:

var=$(fmt -s "$COLUMNS" << "eof"
This is a bunch of text
eof
)

Exceptions

This error may be incorrectly emitted for ksh, where this is allowed. In this case, please either write it in a standard way or ignore this warning.

Further Reading