Listing 1. Check User Mail Script

# Check user mail and send messages if mail
# present
# Marcel Gagné - Salmar Consulting Inc., 1999
for user_name in 'cat /usr/local/etc/mail_notify'
do
   no_messages='frm $user_name |
      grep -v "Mail System Internal Data" |
      wc -l'
   if [ "$no_messages" -gt "0" ]
   then
     echo "You have $no_messages e-mail message \
waiting."> /tmp/$user_name.msg
     echo " " >> /tmp/$user_name.msg
     echo "Please start your email client to \
collect mail." >> /tmp/$user_name.msg
     /usr/bin/smbclient -M $user_name < \
       /tmp/$user_name.msg
   fi
done