On 6/17/19 9:30 AM, Jeremy Townshend wrote:
> Ilkka Virta's email helpfully pointed me to a somewhat related debate that
> occurred about 11 months ago. I agree with your comment in this debate:
>
> "There would be a good case for rejecting the '10#' because it's missing
> the value."
I'll probably do that for bash-5.1. The code is in there and tagged for
later.
>
> It is this silently proceeding with a plausible (but undesirable) output in
> such cases which is especially concerning.
Trying to be helpful rarely works out in every case.
> I cannot find anywhere else in the manual where the word "number", "numeric
> value" or "integer" excludes values less than zero without explicitly stating
> so. On the other hand phrases like "[if] ... number/numeric values less than
> zero", "if ... [not] a number greater than [or equal to] zero" are used
> repeatedly. In those cases "number" clearly doesn't exclude those less than
> zero.
I'm not sure how relevant that language is to integer constants in
expressions. I could also note that the language describing the base#n
syntax only talks about digits, letters, `@', and `_'.
The bash definition of arithmetic evaluation is taken from C. That includes
integer constants, and, while the base#value syntax clearly extends the C
definition of a constant, the `-' (and `+', FWIW) is still an operator as
defined by C.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/