On 1/9/21 12:22 AM, Oğuz wrote:

Here's another trivial side effect of implementing
unary minus using binary minus:

     $ echo $((16#-10))
     -10

Since `-' is an operator, this is not unary minus. It's the same as
$(( 16# - 10 )), which bash before version 5.1 helpfully (or not) treats
identically to $(( 16#0 - 10 )). Bash-5.1 requires at least one digit
after the base specification, so this is a syntax error.


     $ echo $((-16#10))
     -16

This is unary minus applied to an integer constant.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to