[CentOS] OT ? Shell script

Maciej Żenczykowski maze at cela.pl
Sun Dec 4 14:30:59 UTC 2005


How about something like:

YEAR=2005
MONTH=12
for ((DAY=1;DAY<=31;++DAY)); do
   LC_ALL=C TZ=UTC date -d "$YEAR-$MONTH-$DAY"
done | grep "^Mon " | head -n 3 | tail -n 1

Possibly without the TZ=UTC depending on your needs...

Cheers
MaZe?

On Sun, 4 Dec 2005, Robert wrote:

> Does anyone have an elegant solution for finding the date of the 3rd Monday 
> each month and the date of the Sunday preceding?  (Sunday shouldn't be beyond 
> my capabilities, once the Monday part is worked out.)
> For the past several years, I've been handling the chore using a file with a 
> manually input list of dates -- which is about as elegant as driving a tack 
> with a sledge hammer.
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



More information about the CentOS mailing list