Cover V02, I04
Article
Listing 1
Listing 2
Sidebar 1

jul93.tar


Listing 1: weekdaynum script

#!/bin/sh
#
#       weekdaynum
#
#       The 1st parameter is a number representing
#       the which weekday is desired, such as the 2nd
#       Thursday, or 4th Sunday.  Returns TRUE if
#       today is that day.
#
#       Copyright, Jan 12, 1993 by Lawrence S Reznick

if [ $# -lt 1 ]
then
exit `false`
fi

whichday=$1

set `date`

test `expr $3 % 7` -eq 0
flag=$?

test `expr $3 / 7 + $flag` -eq $whichday