Re: [SLUG] BASH oddity

2005-09-19 Thread Vino Fernando Crescini
I have put together a bash script that does a bit of maths, but I keep getting this odd message: script.sh: line 68: 09: value too great for base (error token is "09") The specific line 68 (last below), and the immediately preceding lines, in the script read: OUR_TZ_OSET="$

Re: [SLUG] BASH oddity

2005-09-19 Thread Matthew Hannigan
On Tue, Sep 20, 2005 at 12:49:23PM +1000, Robert Thorsby wrote: > Why not let the date command do all the work for you? Yes! There's another more subtle bug with Howard's code. With OUR_MINS="$(date +%M)" OUR_HRS="$(date +%H)" you will get unexpected values at t

Re: [SLUG] BASH oddity

2005-09-19 Thread Robert Thorsby
On 2005.09.20 12:24 Howard Lowndes wrote: I have put together a bash script that does a bit of maths, but I keep getting this odd message: Why not let the date command do all the work for you? Call date the first time with all the options plus a final argument of %s, then parse the result.

Re: [SLUG] BASH oddity

2005-09-19 Thread Simon Bowden
On Tue, 20 Sep 2005, Simon Bowden wrote: Hi Howard, I had this once, and similarly needed to retain leading 0's (rather than ${var%%0}). This should have been ${foo#0}, and I don't know a good way of removing an arbitrary number of leading zeros without resorting to external tools (or loop

Re: [SLUG] BASH oddity

2005-09-19 Thread Julio Cesar Ody
Maybe you're not willing to use bc... but here it goes anyway. Use: OUR_UTC_MINS=$(echo $OUR_MINS - $OUR_TZ_OSET_MINS | bc) And it works. No idea on how to solve it with bash constructs though... ps: apart from using a regex and removing leading zeroes. On 9/20/05, Howard Lowndes <[EMAIL PROT

Re: [SLUG] BASH oddity

2005-09-19 Thread Simon Bowden
Hi Howard, I had this once, and similarly needed to retain leading 0's (rather than ${var%%0}). The leading zero implies octal numbers. You can force a base with a leading base#, i.e. 10#09 = 09, base 10, rather than 09 base-8 which is invalid. I'm not currently aware of a way of saying "a

[SLUG] BASH oddity

2005-09-19 Thread Howard Lowndes
I have put together a bash script that does a bit of maths, but I keep getting this odd message: script.sh: line 68: 09: value too great for base (error token is "09") The specific line 68 (last below), and the immediately preceding lines, in the script read: OUR_TZ_OSET="$(d