Skip to content

Commit 7e3a9c2

Browse files
committed
CodingGuidelines: describe "export VAR=VAL" rule
https://lore.kernel.org/git/[email protected]/ resulted in 9968fff (test-lint: detect 'export FOO=bar', 2013-07-08) to add a rule to t/check-non-portable-shell.pl script to reject export VAR=VAL and suggest us to instead write it as two statements, i.e., VAR=VAL export VAR This however was not spelled out in the CodingGuidelines document. We may want to re-evaluate the rule since it is from ages ago, but for now, let's make the written rule and what the automation enforces consistent. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 19981da commit 7e3a9c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ For shell scripts specifically (not exhaustive):
188188
hopefully nobody starts using "local" before they are reimplemented
189189
in C ;-)
190190

191+
- Some versions of shell do not understand "export variable=value",
192+
so we write "variable=value" and then "export variable" on two
193+
separate lines.
194+
191195
- Use octal escape sequences (e.g. "\302\242"), not hexadecimal (e.g.
192196
"\xc2\xa2") in printf format strings, since hexadecimal escape
193197
sequences are not portable.

0 commit comments

Comments
 (0)