Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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}."
done

Currently, I get:

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

1 Answer 1

up vote 3 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}.")
done

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

 
discard

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.