From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17055 invoked from network); 13 Jan 2003 21:40:58 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Jan 2003 21:40:58 -0000 Received: (qmail 16578 invoked by alias); 13 Jan 2003 21:40:24 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5698 Received: (qmail 16512 invoked from network); 13 Jan 2003 21:40:23 -0000 From: Carlos Carvalho Message-Id: <15907.12866.732143.310772@fisica.ufpr.br> Date: Mon, 13 Jan 2003 19:40:18 -0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: zsh-users@sunsite.dk Subject: Re: aliases not getting expanded inside functions? In-Reply-To: <1030113184827.ZM21872@candle.brasslantern.com> References: <15893.44217.393956.262362@fisica.ufpr.br> <20030103164552.A28966@globnix.org> <15893.50996.646711.184945@fisica.ufpr.br> <20030103184455.A5692@globnix.org> <15893.53780.524763.695176@fisica.ufpr.br> <20030103185407.GA11836@fysh.org> <15897.15986.562636.628562@fisica.ufpr.br> <1030106125404.ZM4660@candle.brasslantern.com> <15903.36155.716460.639226@fisica.ufpr.br> <1030111184020.ZM11764@candle.brasslantern.com> <15906.65149.206767.381472@fisica.ufpr.br> <1030113184827.ZM21872@candle.brasslantern.com> X-Mailer: VM 7.07 under Emacs 19.34.1 Bart Schaefer (schaefer@brasslantern.com) wrote on 13 January 2003 18:48: >On Jan 13, 3:59pm, Carlos Carvalho wrote: >} >} > fields=( "${(@s:;:)dataline}" ) # Answers your other question >} >} Doesn't work for me: > >Hrm. I was sure I'd tried it, but on your input I get the same result >you do. Well, there's always: > > IFS=';' eval 'fields=( $=dataline )' Good, and it also works without the eval: IFS=';' fields=( $=dataline ) did it for me. >However, it occurs to me that with dataline='...;";";...' -- that is, a >quoted semicolon in the input data -- there's no quick solution that's >going to do exactly what you need. Yes, I know. The only way to deal with this is to parse the line character by character. I'm taking the risk. >So don't name the array "fields", name it "f" or some such. Three extra >characters (e.g. $f[capital] instead of $capital) for a whole lot less >complexity elsewhere. And quote removal may be as easy as: > > f=( ${${(kv)f#\"}%\"} ) > >(Whether it's actually that easy depends on your input data, e.g., you >might also need to convert \" to ", but I think `read' will have done >that for you already.) Quite persuasive :-) (I hope this is still English)