: u-notify
# A user delivery file that tells you when new mail arrives.

user="$1"

# Keep the mail.

echo $user

# Now notify myself (if I'm logged in).

T1=`who | awk '$1 == "'"$user"'" { print $2 }'`
if [ "$T1" ]
then
    # If I'm logged in multiple times,
    # write to the terminal that was most recently busy.

    T2=`cd /dev; ls -t $T1 | sed 1q`
    for t in $T2
    do
	  echo "\n `date '+%D %H:%M'` --" \
	       "you have new mail from `header -f From $HEADER`" \
	       >/dev/$t
    done
fi
