zsh-workers
 help / color / mirror / code / Atom feed
From: Jukka Laurila <jplauril@cc.hut.fi>
To: zsh-workers@sunsite.auc.dk
Subject: Zsh 3.1.6 - ${~foo} expansion bug
Date: Mon, 7 Feb 2000 22:49:55 +0200 (EET)	[thread overview]
Message-ID: <Pine.OSF.4.10.10002072230290.17515-100000@jade.hut.fi> (raw)


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/



             reply	other threads:[~2000-02-07 20:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-07 20:49 Jukka Laurila [this message]
2000-02-07 21:40 ` Bart Schaefer
2000-02-07 22:29   ` Jukka Laurila
2000-02-07 23:16     ` Alexandre Duret-Lutz
2000-02-08  5:19       ` Bart Schaefer
2000-02-07 23:25     ` Thomas Köhler
2000-02-08  9:25 Sven Wischnowsky
2000-02-11 19:27 ` Peter Stephenson
2000-02-14  9:13 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.OSF.4.10.10002072230290.17515-100000@jade.hut.fi \
    --to=jplauril@cc.hut.fi \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).