[SLL] newest "date" in RHL coreutils messes up my script

johnbaxterlists at mac.com johnbaxterlists at mac.com
Fri Jun 1 12:23:37 PDT 2007


On Jun 1, 2007, at 11:12 AM, Glenn Stone wrote:

> On Fri, Jun 01, 2007 at 10:37:32AM -0700, Andrew Sweger wrote:
>> Try,
>>
>> date -d '1jun07 -1 day'
>
> Ooooooh, neat hack!
>
> That would make one's script *much* easier.

I had occasion a couple of months ago to get an answer to "have we  
gotten to the first of the month in GMT yet?"  I chose this method  
(yes there are many others*)

if [ $(date +%b) != $(date --utc +%b) ] ; then
     logger -i Getting blah blah
     exit 0
fi

And yes, there's a race condition, but the script runs at 50 minutes  
past the hour and this happens first thing, so it doesn't matter.

* I mercifully got through school before there were instructors  
claiming that even one extra character was too many characters.

   --John



More information about the linux-list mailing list