Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
scope of variables in loops
- X-seq: zsh-workers 25230
- From: "Joey Mingrone" <joey@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: scope of variables in loops
- Date: Sat, 21 Jun 2008 17:57:55 -0300
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Hello,
Unlike bash, parameters that are set in loops on the command line
stick around. It's not a big deal once you figure out what's going
on, but the code below can cause some head-scratching. Is this
intended? Is it controllable (is there a way to turn it off)?
Thanks,
Joey
zsh 4.3.6 (i386-portbld-freebsd7.0)% for ((x=0; x<=10; x++)) do echo "$x"; done
0
1
2
3
4
5
6
7
8
9
10
zsh 4.3.6 (i386-portbld-freebsd7.0)% for y in `ls *`; do echo $y; done
.Xauthority
.Xmodmap
.aspell.en.prepl
...
...
zsh 4.3.6 (i386-portbld-freebsd7.0)% for x in `ls *`; do echo $x; done
zsh: bad floating point constant
zsh 4.3.6 (i386-portbld-freebsd7.0)% unset x
zsh 4.3.6 (i386-portbld-freebsd7.0)% for x in `ls *`; do echo $x; done
0
1
2
3
4
5
6
7
8
9
10
Messages sorted by:
Reverse Date,
Date,
Thread,
Author