From 83e240bc91e6a5aa823bdcbf2e4c96e61d07fce6 Mon Sep 17 00:00:00 2001 From: koalaman Date: Wed, 20 Jan 2016 14:59:53 -0800 Subject: [PATCH] Created SC1049 (markdown) --- SC1049.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 SC1049.md diff --git a/SC1049.md b/SC1049.md new file mode 100644 index 0000000..0f11cfb --- /dev/null +++ b/SC1049.md @@ -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 \ No newline at end of file