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


Click here to return to the 'August bug - A solution to that nasty bash bug' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
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 | # ]