Running this script
--- snip ---
#!/usr/bin/zsh
emulate zsh
repeat 3; do
local FOO
FOO="0"
done
--- snip ---
Produces this output:
$ ./foo
FOO=0
FOO=0
$ zsh --version
zsh 5.8 (x86_64-debian-linux-gnu)
Why does it print 'FOO=0' to stdout (not stderr) in all passes of
the loop except the first one? Is that some forgotten debug
output? Is there a way to disable that (without writing the
script in a different way)?
Of course I'm aware that (a) using local variables in global scope
is useless and (b) variables are local to functions, not local to
loops. Before stripping down the test case, it was some code in a
function. Moving 'local FOO' out of the loop, or replacing it
with 'local FOO="0"' suppresses the output.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt