Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Dynamically adding to $mailpath?



On 2002-12-19 at 14:42 +0300, Borzenkov Andrey wrote:
> mailpath=((${$(echo ~/mail/*.spool(N))//(#m)*/$MATCH?You have new mail in
> ${MATCH:r:t}}))
> 
> should work though. Unfortunately you still need one fork (echo) unless I
> miss some obvious way to treat result of nested globbing as array.

What I myself actually do is use a couple of temporary variables.

	set -A _foo ~/Mail/Lists/*~*.lock(.) # not D -- don't check .meta etc
	set -A _bar ~/Maildir/.*(/)
	mailpath=( ${MAIL}
                ~/Maildir?"New mail in ~/Maildir"
		"${^_bar[@]//(#m).*/$MATCH?New mail in $MATCH}"
		"${^_foo[@]//(#m)*/$MATCH?You have new mail in ${MATCH:t}}" )
	unset _foo _bar

-- 
"We've got a patent on the conquering of a country through the use of force.
 We believe in world peace through extortionate license fees." -- Andy Forster



Messages sorted by: Reverse Date, Date, Thread, Author