Public bug reported: It seems that arithmetic expansion is completely broken in dash 0.5.51-3ubuntu2 from 10.04.3 LTS:
% /bin/sh -c 'echo $((10-2-3))' # ok so far 5 % /bin/sh -c 'echo $((10-2*0-3))' # what?? 13 % /bin/sh -c 'echo $((10-2*1-3))' # it's not limited to factor being 0 neither 11 This can be worked around by using additional parentheses, e.g. % /bin/sh -c 'echo $(((10-2*1)-3))' 5 FWIW the bug doesn't exist in dash 0.5.7-2 from Debian but I can't find any mention of it being fixed in dash change log so I'm not sure whether it's a dash bug or something Ubuntu-specific. ** Affects: dash (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/932067 Title: Minus associativity not correct in arithmetic expansions To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/dash/+bug/932067/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs