From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20936 invoked from network); 7 Feb 2000 20:50:06 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Feb 2000 20:50:06 -0000 Received: (qmail 15368 invoked by alias); 7 Feb 2000 20:49:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9607 Received: (qmail 15360 invoked from network); 7 Feb 2000 20:49:55 -0000 Date: Mon, 7 Feb 2000 22:49:55 +0200 (EET) From: Jukka Laurila To: zsh-workers@sunsite.auc.dk Subject: Zsh 3.1.6 - ${~foo} expansion bug Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII The following script: #!/bin/zsh foo=* echo for bar in ${~foo}; do echo Looping: $bar; done works as expected, that is, the wildcard is evaluated in line 4: nostromo:/tmp/foodir % ls file1 file2 file3 zshbug* nostromo:/tmp/foodir % ./zshbug Looping: file1 Looping: file2 Looping: file3 Looping: zshbug However, when I remove that redundant-looking 'echo' command... #!/bin/zsh foo=* #echo for bar in ${~foo}; do echo Looping: $bar; done ...the printout changes to this: nostromo:/tmp/foodir % ./zshbug Looping: file1 file2 file3 zshbug ...and even stranger, when I additionally change the command 'echo Looping: $bar;' to 'echo Looping: /usr/$bar;' I get: Looping: /usr/X11R6 /usr/bin /usr/dict /usr/doc /usr/games /usr/i486-linuxlibc1 /usr/include /usr/info /usr/lib /usr/local /usr/man /usr/sbin /usr/share /usr/src Again, putting that redundant echo before the for loop makes the script behave in the proper way. These results were obtained with zsh 3.1.6 from the Debian Potato distribution. When run under zsh 3.0.5-15 from RedHat 6.1 the scripts produce the expected results (the ones obtained with the redundant echo command before the loop). It seems that zsh 3.1.6 evaluates wildcards a bit late in some situations. --------------------------------------------------------------------- --- If tar, vodka and sauna don't help, then the condition is mortal. --- +358503312601 - http://www.hut.fi/~jplauril/