[Bug 218943] /bin/sh regression? with doubly negated numbers
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Apr 30 20:20:00 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218943
John Hein <z7dr6ut7gs at snkmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|New |Closed
Resolution|--- |Works As Intended
--- Comment #2 from John Hein <z7dr6ut7gs at snkmail.com> ---
I see.
Not that bash is necessarily a good model to follow, but it supports the --/++
operators and is able to distinguish between the context when it's an operator
and a double negation.
% bash -c 'var=--123; echo $(($var)); echo $((--var))'
123
122
% bash -c 'echo $((--123))'
123
Same with/without POSIXLY_CORRECT.
But thanks for the explanation. Closing this as 'works as intended'. I guess
sh(1) could be enhanced to distinguish - from context - between the operator
and a double negation (and only throw the error for the former case). I'm sure
it's quite tricky.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list