Commit | Line | Data |
---|---|---|
aa6de038 | 1 | : calendar.sh 4.5 84/02/14 |
492e9668 | 2 | PATH=/bin:/usr/bin: |
aa6de038 RH |
3 | tmp=/tmp/cal0$$ |
4 | trap "rm -f $tmp /tmp/cal1$$ /tmp/cal2$$" | |
492e9668 | 5 | trap exit 1 2 13 15 |
04479c21 BJ |
6 | /usr/lib/calendar >$tmp |
7 | case $# in | |
8 | 0) | |
f02f0c04 | 9 | trap "rm -f $tmp ; exit" 0 1 2 13 15 |
170b3abf | 10 | (/lib/cpp calendar | egrep -f $tmp);; |
04479c21 | 11 | *) |
aa6de038 RH |
12 | trap "rm -f $tmp /tmp/cal1$$ /tmp/cal2$$; exit" 0 1 2 13 15 |
13 | /bin/echo -n "Subject: Calendar for " > /tmp/cal1$$ | |
14 | date | sed -e "s/ [0-9]*:.*//" >> /tmp/cal1$$ | |
04479c21 BJ |
15 | sed ' |
16 | s/\([^:]*\):.*:\(.*\):[^:]*$/y=\2 z=\1/ | |
17 | ' /etc/passwd \ | |
18 | | while read x | |
19 | do | |
20 | eval $x | |
492e9668 BJ |
21 | if test -r $y/calendar |
22 | then | |
aa6de038 | 23 | (/lib/cpp $y/calendar | egrep -f $tmp) 2>/dev/null > /tmp/cal2$$ |
492e9668 BJ |
24 | if test -s /tmp/cal2$$ |
25 | then | |
aa6de038 | 26 | cat /tmp/cal1$$ /tmp/cal2$$ | /bin/mail $z |
492e9668 | 27 | fi |
04479c21 BJ |
28 | fi |
29 | done | |
30 | esac |