From: Junio C Hamano Date: Wed, 30 Apr 2014 21:25:11 +0000 (-0700) Subject: CodingGuidelines: give an example for shell function preamble X-Git-Tag: v2.1.0-rc0~151^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6117a3d4946e35c7d4a38c0b443891c81808a838 CodingGuidelines: give an example for shell function preamble Signed-off-by: Junio C Hamano --- diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 47db6b3ce3..0a574b204c 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -123,9 +123,17 @@ For shell scripts specifically (not exhaustive): - We do not write the noiseword "function" in front of shell functions. - - We prefer a space between the function name and the parentheses. The - opening "{" should also be on the same line. - E.g.: my_function () { + - We prefer a space between the function name and the parentheses, + and no space inside the parentheses. The opening "{" should also + be on the same line. + + (incorrect) + my_function(){ + ... + + (correct) + my_function () { + ... - As to use of grep, stick to a subset of BRE (namely, no \{m,n\}, [::], [==], or [..]) for portability.