mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Initial Page Setup
26
SC1020.md
Normal file
26
SC1020.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## You need a space before the if single then "]" else "]]"
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```
|
||||||
|
if [ "$STUFF" = ""]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```
|
||||||
|
if [ "$STUFF" = "" ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
Bourne shells are very whitespace sensitive. Adding or removing spaces can drastically alter the meaning of a script. In these cases, ShellCheck has noticed that you're missing a space at the position indicated.
|
||||||
|
|
||||||
|
### Exceptions
|
||||||
|
none.
|
||||||
|
|
||||||
|
### Ignore
|
||||||
|
```
|
||||||
|
# shellcheck disable=SC1020
|
||||||
|
if [ "$STUFF" = ""]; then
|
||||||
|
...
|
||||||
|
```
|
Reference in New Issue
Block a user