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 'something like date +"%m"', maybe you could strip off the leading zero? I.e.:

 lastmo=$(echo "$lastmo"|sed -r 's/0+([0-9])/\1/')



Reply via email to