From b077f1726563d66db79f4d754e031fbfb38b16f6 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 10 Oct 2018 21:07:44 -0700 Subject: [PATCH] Updated SC1046 (markdown) --- SC1046.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/SC1046.md b/SC1046.md index 8e57f6d..e4d7b58 100644 --- a/SC1046.md +++ b/SC1046.md @@ -1 +1,30 @@ -# Couldn't find 'fi' for this 'if' \ No newline at end of file +## Couldn't find 'fi' for this 'if'. + +### Problematic code: + +```sh +if true +then + echo "True" +done +``` + +### Correct code: + +```sh +if true +then + echo "True" +fi +``` +### Rationale: + +ShellCheck has found an `if` statement that does not appear to have a matching terminating `fi`. + +This could be because it's missing entirely, or because the `if` statement was incorrectly terminated by a mismatched `done`, `esac`, `)` or similar. A companion warning [[SC1047]] is emitted at the point where ShellCheck expected the `fi`. + +Check that the `if` statement is completely and correctly terminated. + +### Exceptions: + +None \ No newline at end of file