Skip to content

Commit 9dbe780

Browse files
committed
CodingGuidelines: give an example for control statements
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6a49909 commit 9dbe780

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ For shell scripts specifically (not exhaustive):
107107
"then" should be on the next line for if statements, and "do"
108108
should be on the next line for "while" and "for".
109109

110+
(incorrect)
111+
if test -f hello; then
112+
do this
113+
fi
114+
115+
(correct)
116+
if test -f hello
117+
then
118+
do this
119+
fi
120+
110121
- We prefer "test" over "[ ... ]".
111122

112123
- We do not write the noiseword "function" in front of shell

0 commit comments

Comments
 (0)