From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id FAA02496 for ; Mon, 19 Aug 1996 05:20:09 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id PAA10350; Sun, 18 Aug 1996 15:21:39 -0400 (EDT) Resent-Date: Sun, 18 Aug 1996 15:21:39 -0400 (EDT) From: Zefram Message-Id: <13286.199608181845@stone.dcs.warwick.ac.uk> Subject: Re: Unable to process a for loop as expected?? To: dpd@asan.com Date: Sun, 18 Aug 1996 19:45:45 +0100 (BST) Cc: zsh-workers@math.gatech.edu In-Reply-To: <17552567901167@asan.com> from "dpd@asan.com" at Aug 18, 96 01:55:20 pm X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]7983.90 X-US-Congress: Moronic fuckers MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"S38SX2.0.bX2.2rs5o"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2024 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu >list="a b c d" >for character in $list You're trying to have word splitting done on $list, in order to generate multiple words for the for loop. By default zsh does no field splitting. There are three main approaches to this problem. 1. In order to get sh behaviour in this regard, use "setopt sh_word_split". ("emulate sh" will do this, among other things, and zsh will have this option set by default if invoked as sh.) 2. In order to do field splitting here only, leaving the default behaviour unchanged, use $=list instead of $list. 3. In order to make the script use idiomatic zsh, rewrite it using an array: list=(a b c d) for character in $list This last method has the advantage that the values to be looped over can contain whitespace: list=(a b c 'd and some more text with spaces') >BTW, according to the extracted sources, I am using zsh version zsh-2.6-beta19. >However, according to the man pages, I am using zsh version 2.7. (Why >the discrepancy?) For a while the man pages said 2.7 because that was expected to be the next public release, and it would be too much trouble to change the man pages every version. The latest release is 3.0.0, and the man pages say 3.0. >I am running the LINUX operating system, version 1.3.91. Not a terribly stable version, AFAIK. Apparently 1.3.98 and 1.3.100 are much better. (I'm still running 1.3.80 -- very stable.) -zefram