Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2017 20:20:00 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 218943] /bin/sh regression? with doubly negated numbers
Message-ID:  <bug-218943-8-znhDl76fHb@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-218943-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-218943-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218943

John Hein <z7dr6ut7gs@snkmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Closed
         Resolution|---                         |Works As Intended

--- Comment #2 from John Hein <z7dr6ut7gs@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 opera=
tor
and a double negation.

% bash -c 'var=3D--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 gu=
ess
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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-218943-8-znhDl76fHb>