Dear Maintainer,
SUSv3 lists the prefix and postfix ++ and -- operators as "not
required"[1] during arithmetic expansion and their use is not excepted
from the requirements of Policy 10.4. In practice, using these
operators would be a bad idea since they are not currently supported in
dash (the postfix versions cause syntax errors while the prefix versions
are silently ignored). An example of current behavior across shells is:
$ FOO=1 bash -c 'echo $((FOO++)) $((++FOO))'
1 3
$ FOO=1 dash -c 'echo $((FOO++))'
dash: 1: arithmetic expression: expecting primary: "FOO++"
$ FOO=1 dash -c 'echo $((++FOO)) $((++FOO))'
1 1
$ FOO=1 posh -c 'echo $((FOO++)) $((++FOO))'
1 3
I would suggest removing support for these operators from posh so that
shell scripts which rely on them can be identified and fixed.
Thanks for considering,
Kevin
1. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04