mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1121 (markdown)
31
SC1121.md
Normal file
31
SC1121.md
Normal file
@@ -0,0 +1,31 @@
|
||||
## Add ;/& terminators (and other syntax) on the line with the <<, not here.
|
||||
|
||||
### Problematic code:
|
||||
|
||||
```sh
|
||||
sudo bash -s << "END"
|
||||
cmd1
|
||||
cmd2
|
||||
END &
|
||||
|
||||
```
|
||||
|
||||
### Correct code:
|
||||
|
||||
```sh
|
||||
sudo bash -s << "END" &
|
||||
cmd1
|
||||
cmd2
|
||||
END
|
||||
```
|
||||
### Rationale:
|
||||
|
||||
You are using `&`, `;`, `&>` or similar after a here document. This is not allowed.
|
||||
|
||||
This should instead be part of the line that initiated the here document, i.e. the one with the `<<`.
|
||||
|
||||
If it helps, look at `<< "END"` as if it was `< file`, and make sure the resulting command is valid. This is what the shell does. You can then append here document data after the command.
|
||||
|
||||
### Exceptions:
|
||||
|
||||
None.
|
Reference in New Issue
Block a user