CodingGuidelines: spell Arithmetic Expansion with $(($var))
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>
Junio C Hamano committed
Sep 22, 2010 at 12:15 UTC
055467dd4ae7fac2cf3149352710a5ee64b2138c
1 file changed
+4
Documentation/CodingGuidelines
+4
@@ -43,6 +43,10 @@ For shell scripts specifically (not exhaustive):
43
44
- We use Arithmetic Expansion $(( ... )).
45
46
+ - Inside Arithmetic Expansion, spell shell variables with $ in front
47
+ of them, as some shells do not grok $((x)) while accepting $(($x))
48
+ just fine (e.g. dash older than 0.5.4).
49
+
50
- No "Substring Expansion" ${parameter:offset:length}.
51
52
- No shell arrays.