procmail
[Top] [All Lists]

Fun With Shells (Part 2)

1997-07-11 04:47:00
On Fri, 11 Jul 97 I (Chris Bidmead) wrote:
Can any shell aficionados on this list explain the following
amusement (prompt represents the shell in use). The first two
results are boringly predictable. Bash, however, knows how to keep
you guessing.

And then I read the manual.  Sorry not to have done this first.

From the man pages:

    "Constants with a leading 0 are interpreted as octal numbers."

Blast!  I suppose Mr Posix is to blame for this, er, useful refinement...

The man pages seem to suggest that something like

bash> let N=[10]016

...might force the number to base10, but this doesn't work --  
"[10]016" is rejected as an "error token".

Any suggestions?

el bid

<Prev in Thread] Current Thread [Next in Thread>
  • Fun With Shells (Part 2), Chris Bidmead <=