mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2289 (markdown)
32
SC2289.md
Normal file
32
SC2289.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
## This is interpreted as a command name containing a linefeed. Double check syntax.
|
||||||
|
|
||||||
|
(or tab)
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
'''
|
||||||
|
This script greets the planet
|
||||||
|
'''
|
||||||
|
echo "Hello World"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# This script greets the planet
|
||||||
|
echo "Hello World"
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
ShellCheck found a command name containing an especially unusual character like a tab or linefeed. This is most likely due to a syntax issue.
|
||||||
|
|
||||||
|
In the example, this was due to a Python style documentation string, which a shell will merely interpreted as a multi-line command name sandwiched between two empty strings.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
If you have a command name that *does* contain a tab or linefeed you can ignore this message, but... wow.
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
|
||||||
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user