mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC1048 (markdown)
@@ -8,9 +8,7 @@ then
|
|||||||
# TODO: handle this
|
# TODO: handle this
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
if [ -e foo ]
|
if [ -e foo ]
|
||||||
then
|
then
|
||||||
@@ -19,14 +17,13 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Or use the no-op colon operator ":"
|
# Or use the no-op colon operator ":"
|
||||||
```sh
|
|
||||||
if [ -e foo ]
|
if [ -e foo ]
|
||||||
then
|
then
|
||||||
# TODO: handle this
|
# TODO: handle this
|
||||||
:
|
:
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
```
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
Shells do not allow empty `then` clauses. They need at least one command (and comments are not commands).
|
Shells do not allow empty `then` clauses. They need at least one command (and comments are not commands).
|
||||||
|
Reference in New Issue
Block a user