Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I modify the following so that it reads maildir and not just mailbox format?

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

Currently, I get:

/home/XXX/.zshrc:77: no matches found: /home/XXX/.Mail/Lists/*(.)
share|improve this question
up vote 4 down vote accepted

You need to enumerate the directories called new under ~/Mail/Lists/. It's just a matter of a few glob qualifiers: / to match directories, and maybe N so that the expansion is empty if there is no match. Use ${i:h:t} to show the name of the mailbox instead of new.

for i in ~/Mail/Lists/**/new(/N); do
  mailpath+=("${i}?You have new mail in ${i:h:t}.")

You can use the e glob qualifier to make this a one-liner, albeit a cryptic one.

maildirs+=(~/Mail/Lists/**/new(/Ne\''REPLY="${REPLY}?You have new mail in ${REPLY:h:t}."'\'))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.