From: Junio C Hamano Date: Wed, 30 Apr 2014 21:24:52 +0000 (-0700) Subject: CodingGuidelines: give an example for control statements X-Git-Tag: v2.1.0-rc0~151^2~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9dbe780174892a35d6f1e19495c13b9edb9d88fd CodingGuidelines: give an example for control statements Signed-off-by: Junio C Hamano --- diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 11704fb84c..47db6b3ce3 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -107,6 +107,17 @@ For shell scripts specifically (not exhaustive): "then" should be on the next line for if statements, and "do" should be on the next line for "while" and "for". + (incorrect) + if test -f hello; then + do this + fi + + (correct) + if test -f hello + then + do this + fi + - We prefer "test" over "[ ... ]". - We do not write the noiseword "function" in front of shell