From 055467dd4ae7fac2cf3149352710a5ee64b2138c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 22 Sep 2010 12:15:37 -0700 Subject: [PATCH] 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 --- Documentation/CodingGuidelines | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index b8bf618a3..8346c1972 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. -- 2.30.2