Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15050 > unrolled thread
| Started by | Ilkka Virta <itvirta@iki.fi> |
|---|---|
| First post | 2019-06-14 21:30 +0300 |
| Last post | 2019-06-14 21:30 +0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Arithmetic evaluation of negative numbers with base prefix Ilkka Virta <itvirta@iki.fi> - 2019-06-14 21:30 +0300
| From | Ilkka Virta <itvirta@iki.fi> |
|---|---|
| Date | 2019-06-14 21:30 +0300 |
| Subject | Re: Arithmetic evaluation of negative numbers with base prefix |
| Message-ID | <mailman.93.1560537058.10840.bug-bash@gnu.org> |
On 14.6. 17:19, Jeremy Townshend wrote: > echo $((10#-1)) # -1 as expected Earlier discussion about the same on bug-bash: https://lists.gnu.org/archive/html/bug-bash/2018-07/msg00015.html Bash doesn't support the minus (or plus) sign following the 10#. I think the expression above seems to work in this case because 10# is treated as a constant number by itself (with a value of 0), and then the 1 is subtracted. try also e.g.: $ echo $((10#)) 0 > echo $((0-10#-1)) # -1 UNEXPECTED. Would expect 1. So this is 0-0-1 = -1 -- Ilkka Virta / itvirta@iki.fi
Back to top | Article view | gnu.bash.bug
csiph-web