Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'The ultimate 3-column calendar' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The ultimate 3-column calendar
Authored by: icerabbit on Aug 02, '04 11:31:26AM

The only odd thing is, with a copy/paste into GeekTool, I get the month August three times. Not July - August - September



[ Reply to This | # ]
The ultimate 3-column calendar
Authored by: gent99 on Aug 03, '04 05:48:03AM

Strange things happen in August:

This little Script displays an error only in August:

#!/bin/sh
month=`date +%m`
themonth=$(($month+$1))
echo $themonth


Error: 08: value too great for base (error token is "08")

Every other month works fine.

Any U++x freak who can help us?



[ Reply to This | # ]
The ultimate 3-column calendar
Authored by: icerabbit on Aug 03, '04 08:39:36AM

I have the same error line.
Will see if there's a way to contact Wallybear.



[ Reply to This | # ]
The ultimate 3-column calendar
Authored by: Herbo on Aug 03, '04 01:06:16PM

The problem seems to be how bash handles leading zeros, it treats the number as octal rather than base 10. Hence 8 is an invalid octal number (valid range being 0 to 7).

Try removing the leading zero from the month by changing the month assignment line to:

month=`date +%m | sed -e 's/^0//'`

-Herbo



[ Reply to This | # ]
The ultimate 3-column calendar
Authored by: icerabbit on Aug 03, '04 06:25:42PM

By Joe,
That works!
Thanks Herbo :)



[ Reply to This | # ]
The ultimate 3-column calendar
Authored by: gent99 on Aug 04, '04 03:30:58AM

Actually this is a bug in bash. look here:

http://lists.debian.org/debian-boot/2000/05/msg00287.html

i managed to fix it with the following code:

month=`expr $month + 0`

this is working too.



[ Reply to This | # ]
August bug - A solution to that nasty bash bug
Authored by: wallybear on Sep 06, '04 05:52:28AM

The problem is due to a bug of bash. it treats '08' as an octal, because of the leading zero.
The only available token of the date command to get the month's number gives a number with a leading zero for the range 1..9 (01..09).
A simple solution (btw I hope that a simpler one exists) is to replace the following line at the beginning of the script:

month=`date +%m`

with this one:

month=`date +%m | awk '{print int($0)}'`

this will strip the leading zero if present and fix the bug.
The bug does not show with the day's number as in this case the leading zero is stripped by the appropriate 'date' token.

Happy geektooling...



[ Reply to This | # ]