mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2286 (markdown)
31
SC2286.md
Normal file
31
SC2286.md
Normal file
@@ -0,0 +1,31 @@
|
||||
## This empty string is interpreted as a command name. Double check syntax (or use 'true' as a no-op).
|
||||
|
||||
### Problematic code:
|
||||
|
||||
```sh
|
||||
jq
|
||||
''
|
||||
file.json
|
||||
```
|
||||
|
||||
### Correct code:
|
||||
|
||||
```sh
|
||||
jq \
|
||||
'' \
|
||||
file.json
|
||||
```
|
||||
|
||||
### Rationale:
|
||||
|
||||
ShellCheck found an empty string used as a command name. This is never valid.
|
||||
|
||||
If the command is intended to do nothing, use `true` aka `:` instead. Otherwise, determine why an empty string ended up as a command name and fix it accordingly. In the example, each line was interpreted as a separate command due to missing line continuations.
|
||||
|
||||
### Exceptions:
|
||||
|
||||
None
|
||||
|
||||
### Related resources:
|
||||
|
||||
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user