From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17967 invoked from network); 19 Feb 2004 16:47:47 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Feb 2004 16:47:47 -0000 Received: (qmail 9463 invoked by alias); 19 Feb 2004 16:47:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7061 Received: (qmail 9424 invoked from network); 19 Feb 2004 16:47:05 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Feb 2004 16:47:05 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.193.203.32] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Feb 2004 16:47:3 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id i1JGkte00714 for ; Thu, 19 Feb 2004 17:46:56 +0100 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1AtrJn-0000kG-00>; Thu, 19 Feb 2004 17:46:31 +0100 Date: Thu, 19 Feb 2004 17:46:31 +0100 From: DervishD To: Zsh Users Subject: Can this be done with an array parameter? Message-ID: <20040219164631.GB2804@DervishD> Mail-Followup-To: Zsh Users Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4i Organization: Pleyades User-Agent: Mutt/1.4i Hi all :) I need to process some file contents line-by-line, and I was going to do it by using a loop, like this: cat filename | while read line do things to do with $line done Since some of the work would be better done with an array, I changed this to: set -A info cat filename | while read line do info=($info $line) done This effectively store every line as a separate item in the array parameter, which surprises me. Lets assume the file contents are: A line Another line Yet another line More lines below Then the loop will result in (just guessing...): info=( A line) info=(A line Another line) info=(A line Another line Yet another line) info=(A line Another line Yet another line More lines below) But instead, the 'line' seems to be added *quoted* :?? It's like Zsh is reading my mind or so. Can anybody explain? As far as I knew, the more correct way of doing the assignment in the loop, will be: index=$(($index+1)) info[$index]="$line" considering 'index' value of '0' at start. And my original question: can the array be assigned one line of the file per slot without the loop? Thanks a lot in advance :) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/