summaryrefslogtreecommitdiff
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-09-22 19:15:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-27 17:45:29 (GMT)
commit055467dd4ae7fac2cf3149352710a5ee64b2138c (patch)
tree1964b9f2d099b426d68bad774e9ceb71cc8c23e4 /Documentation/CodingGuidelines
parent4098f6717b8137493dddfc1a28a72b25769ed7bc (diff)
downloadgit-055467dd4ae7fac2cf3149352710a5ee64b2138c.zip
git-055467dd4ae7fac2cf3149352710a5ee64b2138c.tar.gz
git-055467dd4ae7fac2cf3149352710a5ee64b2138c.tar.bz2
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>
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines4
1 files changed, 4 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index b8bf618..8346c19 100644
--- 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.