blah
June 18th, 2009, 01:58
When I prefix while loop with pipe sh eats my global variable assigned inside the loop body$ echo baz | while true; do foo=blah; echo $foo; break; done
blah
$ echo $foo
$So, it's visible inside loop but not outside. Why it's invisible only when as part of a pipe?$ while true; do foo=blah; echo $foo; break; done
blah
$ echo $foo
blah
$In zsh it's visible in both cases.
8-CURRENT r194410M amd64 here.
blah
$ echo $foo
$So, it's visible inside loop but not outside. Why it's invisible only when as part of a pipe?$ while true; do foo=blah; echo $foo; break; done
blah
$ echo $foo
blah
$In zsh it's visible in both cases.
8-CURRENT r194410M amd64 here.