From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7219 invoked from network); 19 Dec 2002 11:42:12 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Dec 2002 11:42:12 -0000 Received: (qmail 10329 invoked by alias); 19 Dec 2002 11:41:59 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5594 Received: (qmail 10319 invoked from network); 19 Dec 2002 11:41:58 -0000 Date: Thu, 19 Dec 2002 12:41:52 +0100 From: Phil Pennock To: Aidan Kehoe Cc: zsh-users@sunsite.dk Subject: Re: Dynamically adding to $mailpath? Message-ID: <20021219124152.A12702@globnix.org> Mail-Followup-To: Aidan Kehoe , zsh-users@sunsite.dk References: <15873.44013.976882.301072@gargle.gargle.HOWL> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15873.44013.976882.301072@gargle.gargle.HOWL>; from kehoea@parhasard.net on Thu, Dec 19, 2002 at 11:22:21AM +0000 X-Disclaimer: Any views expressed in this message, where not explicitly attributed otherwise, are mine and mine alone. Such views do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. On 2002-12-19 at 11:22 +0000, Aidan Kehoe wrote: > for i in ~/mail/*.spool; do > set $mailpath[$#mailpath+1]="${i}?You have new mail in $(basename $i .spool)."; > done > > have worked? I got around it by using $MAILPATH, but No, since you set a variable using its name without a $ beforehand. I have this problem too, when I've been writing too much Perl. For some reason, the "set" there means that the array part isn't in arithmetic context, in fact the rest is not evaluated properly, but is instead treated as one string (or two, with s/=/ /) and put into ARGV. Since "z" is at the end of the alphabet: % print -l $@ mailpath[0+1]=/home/phil/Mail/Lists/zsh?You have new mail in zsh. % Lose the "set $" and it works for me, after changing to my set-up. And one optimisation, dropping the subshell ... typeset -a mailpath for i in ~/Mail/Lists/*(.); do mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}." done -- "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