Not off topic ;-) I need to get last month from the date
So, do this
MON=`date +"10#%m"`
((MON=$MON-1))
echo $MON
8
I hate when I do that. Of course if you do this in January your MON
becomes zero and other things need to adjust like the year.
Suppose you want to write out a web statistics report for last month,
with an appropriate filename.
I do believe this handles the boundary condition, and invokes "date"
the fewest times possible. ;-)