Checking multiple mailboxes

Zsh can check if you have new mail before each prompt is printed. This was useful in the past when local file-based mail spools were common but it is still useful for system mail to admin accounts or if you still have mail delivered locally.

Simple:

mailpath=($HOME/Mail/mbox'?new mail in mbox'
HOME/Mail/tux.u-strasbg'?new mail in tux'
$HOME/Mail/lilo'?new mail in lilo'
$HOME/Mail/ldap-fr'?new mail in ldap-fr')

Dynamic:

for i in ~/Mail/Lists/*(.); do
  mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}."
done

Note, that this solution expects mboxes below ~/Mail/Lists/. I you have got Maildirs, then change the globbing qualifier from (.) to (/).

 
examples/mathpath.txt · Last modified: 2015/12/08 09:13 by spamkiller