#!/usr/local/bin/bash# Notifies users of newly received mail
NewMail(){NEWMAIL=$(mailx&)UNREAD=$(echo$NEWMAIL|grep-o'messages.*new'|cut-f2-d" ")}
NewMail# call NewMail functionUNREAD=${UNREAD/>/}if[-n"$UNREAD"];thenecho"`whoami` you have $UNREAD new mail(s) "fi