Re: doing simple math in bash :: prb with leading zero

2009-09-01 Thread pk
ken wrote: > This is what I get on Linux running on an i686. > > Bash should be smart enough to know that 09 = 9 > -- and it does sometimes, but not all the time. > Surprise!! >From the bash manual: "Constants with a leading 0 are interpreted as octal numbers. A leading 0x or 0X denotes hexade

Re: doing simple math in bash :: prb with leading zero

2009-09-01 Thread Chris F.A. Johnson
On Tue, 1 Sep 2009, ken wrote: > Doing very simple math in bash fails if a number begins with a zero (0). Numbers beginning with 0 are base 8 (octal). 08 and 09 are not valid octal numbers. -- Chris F.A. Johnson, webmaster ==

Re: doing simple math in bash :: prb with leading zero

2009-09-01 Thread Chris F.A. Johnson
On Tue, 1 Sep 2009, Linda Walsh wrote: > ken wrote: > > Doing very simple math in bash fails if a number begins with a zero (0). > > The short script below illustrates the problem: > --- > Normally, a leading 0 begins an octal constant (I have been bitten > by this in the past as well...). > > W

Re: doing simple math in bash :: prb with leading zero

2009-09-01 Thread Linda Walsh
ken wrote: Doing very simple math in bash fails if a number begins with a zero (0). The short script below illustrates the problem: --- Normally, a leading 0 begins an octal constant (I have been bitten by this in the past as well...). Where are you getting the value 'lastmo' from? If from '

Re: doing simple math in bash :: prb with leading zero

2009-09-01 Thread Bob Proulx
ken wrote: > Doing very simple math in bash fails if a number begins with a zero (0). Thanks for the report. However it isn't a bug but simply a misunderstanding. Numbers starting with 0 are octal numbers not decial numbers. And as you know octal numbers includes zero through seven but does not