#!/bin/bash MAILS=$(echo x | mail -f /home/miguel/mail/default | head -n 2 | tail -n 1 | cut -d" " -f 4-) case $MAILS in *new*) echo "$MAILS" ;; *unread*) echo "$MAILS" ;; *) echo "no mail" ;; esac