Cute (.login || .profile) program
Chris Torek
chris at umcp-cs.UUCP
Sat Jan 12 09:56:34 AEST 1985
Gee, we force this one on everyone here! We have in /usr/lib/crontab
the line
2 0,6,12,18 * * * /usr/local/etc/motd_ed
with the motd_ed script reading:
#! /bin/csh -f
set file=/tmp/med_$$
cat <<'fin' >$file
g/Good morning!/d
g/Good afternoon!/d
g/Good evening!/d
g/What are you doing on at this time of night?/d
$-1a
'fin'
set time=`date | awk '{printf $4}' | awk -F: '{print $1}'`
if ($time < 6) then
echo 'What are you doing on at this time of night?' >>$file
else if ($time < 12) then
echo 'Good morning\!' >>$file
else if ($time < 18) then
echo 'Good afternoon\!' >>$file
else
echo 'Good evening\!' >>$file
endif
cat <<'fin' >>$file
.
w
q
'fin'
ex - /etc/motd <$file
rm $file
(We also have /etc/rc.local invoke this to fix the motd when rebooting.)
--
(This line accidently left nonblank.)
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.sources.unix
mailing list