about summary refs log blame commit diff stats
path: root/bin/newmail.sh
blob: 6ed65e62b7700adc2e5fc19db4ad81f31e8db25c (plain) (tree)
1
2
3
4
5

                     
                                       
                         
 









                                                                    
#!/usr/local/bin/bash

# Notifies users of newly received mail
# kneezle@tilde.institute

NewMail(){
    NEWMAIL=$(mailx &)
    UNREAD=$(echo $NEWMAIL |grep -o 'messages.*new' | cut -f2 -d" ")
}
NewMail # call NewMail function
UNREAD=${UNREAD/>/}

if [ -n "$UNREAD" ]; then
    echo "`whoami` you have $UNREAD new mail(s) "
fi