[clug] CLUG meeting 21 August 2003

Brett Worth brettw at cray.com
Mon Aug 18 07:51:54 EST 2003


On Mon, 18 Aug 2003, Michael Still wrote:

> As a challenge, anyone care to fix it so that months with no Thursday on 
> the first line don't cause this bug?
>
> -------
> #!/bin/bash
> 
> export day=`date +"%d"`
> export month=`date +"%B"`
> mon=`date +"%m"`
> export year=`date +"%Y"`
> 
> thurs=`cal $mon $year | head -6 | tail -1 | cut -f 5 -d " "`

thurs = `cal $mon $year | awk ' NF >= 5 { t = $5 } END { print t } '`

> nthurs=$(( $day + 3 ))
> export thurs
> 
> if [ $nthurs = $thurs ]
> then
>   ./subst.pl < template | mail -s "CLUG meeting $thurs $month $year" mikal
> else
>   echo "nothing" | mail mikal
> fi
> -----

-- 
Brett




More information about the linux mailing list