admin/bin/newmail.sh

16 lines
327 B
Bash
Raw Normal View History

2019-03-13 08:49:32 +00:00
#!/usr/local/bin/bash
2019-03-26 02:07:20 +00:00
# Notifies users of newly received mail
2020-05-06 06:13:47 +00:00
# kneezle@tilde.institute
2019-03-26 02:07:20 +00:00
2019-03-13 08:49:32 +00:00
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