Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
CodingGuidelines: spell Arithmetic Expansion with $(($var))
author
Junio C Hamano
<gitster@pobox.com>
Wed, 22 Sep 2010 19:15:37 +0000
(12:15 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 27 Sep 2010 17:45:29 +0000
(10:45 -0700)
POSIX wants shells to support both "N" and "$N" and requires them to yield
the same answer to $((N)) and $(($N)), but we should aim for portability
in a case like this, especially when the price we pay to do so is so
small, i.e. a few extra dollars.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/CodingGuidelines
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
4098f67
)
diff --git
a/Documentation/CodingGuidelines
b/Documentation/CodingGuidelines
index b8bf618a30fd32a014e41e1ba9914f5e652bdefd..8346c1972be24abf4e4269b9171a0eb456c2895a 100644
(file)
--- a/
Documentation/CodingGuidelines
+++ b/
Documentation/CodingGuidelines
@@
-43,6
+43,10
@@
For shell scripts specifically (not exhaustive):
- We use Arithmetic Expansion $(( ... )).
+ - Inside Arithmetic Expansion, spell shell variables with $ in front
+ of them, as some shells do not grok $((x)) while accepting $(($x))
+ just fine (e.g. dash older than 0.5.4).
+
- No "Substring Expansion" ${parameter:offset:length}.
- No shell arrays.