From 9dbe780174892a35d6f1e19495c13b9edb9d88fd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Apr 2014 14:24:52 -0700 Subject: CodingGuidelines: give an example for control statements Signed-off-by: Junio C Hamano --- Documentation/CodingGuidelines | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Documentation/CodingGuidelines') 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 -- cgit v1.2.3