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 PROTECTED]> wrote: > 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="$(date +%z)" > OUR_TZ_OSET_MINS=$((${OUR_TZ_OSET:3:2})) > OUR_TZ_OSET_HRS=$((${OUR_TZ_OSET:1:2})) > > OUR_MINS="$(date +%M)" > OUR_HRS="$(date +%H)" > OUR_DATE="$(date +%d)" > > OUR_UTC_MINS=$(($OUR_MINS-$OUR_TZ_OSET_MINS)) > > This problem only seems to occur with some values of $OUR_MINS which > have a leading "0" (specifically "09" in this instance), when the > leading digit is other than that ("1" thru "5") there appears to be no > problem. > > Any clues? I really do need to retain the leading "0" if possible when > it exists. > > -- > Howard. > LANNet Computing Associates - Your Linux people <http://lannet.com.au> > -- > When you just want a system that works, you choose Linux; > When you want a system that just works, you choose Microsoft. > -- > Flatter government, not fatter government; > Get rid of the Australian states. > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- Julio C. Ody http://rootshell.be/~julioody -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html