begin quoting John H. Robinson, IV as of Thu, Jul 19, 2007 at 12:16:31PM -0700: [snip] > 7) grep foo bar | while read line; do ((count++)); done > Under bash, the value of count will not have changed as the pipelines > are under subshells. zsh does not do this. > > for i in 1 2 3; do echo foo; done > bar > unset count > > $ grep foo bar | while read line; do ((count++)); done > $ echo :$count: > :: > > % grep foo bar | while read line; do ((count++)); done > % echo :$count: > :3:
Not sure I'd consider this a feature. Subshells are *supposed* to be divorced from their parent environment. [snip] > Some people may decry that zsh does not split on whitespace, inside a > variable, so they can't do a="1 2 3 4 5"; for i in $a; do [something > five time]; done. This is a throwback to sh, when there were no arrays, > so the scalars were overloaded to be arrays, and bash continues this > dubious tradition. Can you split a string into an array at the whitespace? /me pokes around Ah... yes, you can. > % a=(1 2 3 4 5); for i in $a; do [something five times]; done % a="1 2 3 4 5"; for i in $=a ; do echo $i ; done [snip] > chsh -s "`command which zsh`" It seems zsh does not set the SHELL environment variable. -- If you take away my tcsh, at least give me zsh. Stewart Stremler -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
