Skip to content

Commit 6117a3d

Browse files
committed
CodingGuidelines: give an example for shell function preamble
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9dbe780 commit 6117a3d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Documentation/CodingGuidelines

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,17 @@ For shell scripts specifically (not exhaustive):
123123
- We do not write the noiseword "function" in front of shell
124124
functions.
125125

126-
- We prefer a space between the function name and the parentheses. The
127-
opening "{" should also be on the same line.
128-
E.g.: my_function () {
126+
- We prefer a space between the function name and the parentheses,
127+
and no space inside the parentheses. The opening "{" should also
128+
be on the same line.
129+
130+
(incorrect)
131+
my_function(){
132+
...
133+
134+
(correct)
135+
my_function () {
136+
...
129137

130138
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
131139
[::], [==], or [..]) for portability.

0 commit comments

Comments
 (0)