mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-04 03:46:06 +08:00
Created SC1120 (markdown)
27
SC1120.md
Normal file
27
SC1120.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
## No comments allowed after here-doc token. Comment the next line instead.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cat << eof # --- Start greeting --
|
||||||
|
Hello
|
||||||
|
eof # --- End greeting ---
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
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 after it.
|
||||||
|
|
||||||
|
Move the comment somewhere else, such as the next line.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
Reference in New Issue
Block a user