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>
This commit is contained in:
Junio C Hamano 2010-09-22 12:15:37 -07:00
Родитель 4098f6717b
Коммит 055467dd4a
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -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.