bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in arithmetic expansion


From: Robert Elz
Subject: Re: bug in arithmetic expansion
Date: Sun, 10 Nov 2019 00:14:10 +0700

    Date:        Sat, 9 Nov 2019 16:39:52 +0100
    From:        Davide Brini <address@hidden>
    Message-ID:  <address@hidden>

  | If you want to force base 10 interpretation (remember that leading 0 mean
  | octal in arithmetic context), you need to explicitly tell bash:
  |
  | $ echo $(( 10#0123 ))
  | 123

But do remember that that form is not portable, and is difficult to
use correctly in the cases that matter (when the actyal number comes
from a variable .. when it is literal, as in all the examples in this
thread, simply omitting the leading 0 is much simpler, and fully portable).

kre





reply via email to

[Prev in Thread] Current Thread [Next in Thread]