Created SC1049 (markdown)

koalaman
2016-01-20 14:59:53 -08:00
parent 657f12cc15
commit 83e240bc91

32
SC1049.md Normal file

@@ -0,0 +1,32 @@
## Did you forget the 'then' for this 'if'?
### Problematic code:
```sh
if true
echo "foo"
elif true
echo "bar"
fi
```
### Correct code:
```sh
if true
then
echo "foo"
elif true
then
echo "bar"
fi```
### Rationale:
ShellCheck found a parsing error in the script, and determined that it's most likely due to a missing `then` keyword for the `if` or `elif` indicated.
Make sure the `then` is there. It needs `;` or linefeed before it (e.g. `if true; then`, not `if true then`).
### Exceptions:
None