doing simple math in bash :: prb with leading zero

2009-09-01 Thread ken
Doing very simple math in bash fails if a number begins with a zero (0). The short script below illustrates the problem: --- begin #!/bin/bash #Testing number decrement because I ran into an errors #e.g., lastmo=$((${lastmo}-1)) returns error: # 09:

Who handles fails to build problems for bash?

2009-09-01 Thread Tovrea, George W (US SSA)
Could not find any groups other than this for bash problems. My build is failing with make[1]: Leaving directory `/home/users/tovrea/BASH/build_sgi_bash/lib/tilde' rm -f bash /home/users/tovrea/local/sgi6/bin/gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde

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

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-09-01 Thread Linda Walsh
Chet Ramey wrote: Note that [[ and [ return different results when the vars are unquoted. Yes. There are two differences. First, the operands in [[ do not undergo all word expansions. The arguments to [, since it's a builtin, do. That doesn't really matter to this example, but it's worth

Re: Who handles fails to build problems for bash?

2009-09-01 Thread Chet Ramey
Could not find any groups other than this for bash problems. My build is failing with make[1]: Leaving directory `/home/users/tovrea/BASH/build_sgi_bash/lib/tilde' rm -f bash /home/users/tovrea/local/sgi6/bin/gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde

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 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...). Where are

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 http://woodbine-gerrard.com

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 hexadecimal.