Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Mysterious (debug?) output in loop
- X-seq: zsh-users 28846
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Mysterious (debug?) output in loop
- Date: Sun, 29 Jan 2023 21:13:36 +0100
- Archived-at: <https://zsh.org/users/28846>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- Reply-to: dominik.vogt@xxxxxx
- Ui-outboundreport: notjunk:1;M01:P0:CFzepSnTLlo=;LiLTmV8rrRG2ikmE7suIIEKncGt hAFTponunLytvJ+IrNYNWjgptfimkJwsGAlXlTuByI6dl6fWI18z78P3Ws+DTFE0NQ0LCApt6 VcPoGd512lkeDRBe+3V/7Lpo5pywkH/NQC07P1R616uNjQsLFIDtp81egpAB6YErMaHHXod2l XxNo/ThWisNx3y8k01CTjVKROR7nStk3wqP+DYRdVvvjTDWO+xm3sSj/Sw52vGUX5ne9ZTvWH csVE+nYGIoOrM/MtvX8z5uQFYn7+xTBle3au1NQy4hkxR0kWu8w6N2QOwfnfMD/yAN2GA3xwK p3pZsz74qv0JkmLY37mlRelOltCMO1kXxvinHVp1J2OnZKraAhCzkfJnv6Q88TE2iSzb9fnop ONgeSiMqsFbrXqlD2LDOorofiMMzCUclDJW7IASDMvOG6Pxk9LCSDJS0qC36bsDSvvNoxg1VT YvYN+SNHrXzAgawbuxkYX3UDLWXRcn74dc8Np6yJBFevEyTtIqJsDy5B1HqGWeXcOXhD8woCn m9l4rXv1RvXpGnp5ceIh5380/QtCDwCgF6EPYLD5AFokKIMcWL+pi8BhhNpGmed7bb5M40Q84 z1uiVh2yHQrkSCr7DBzukncLyq8qmsKRYkz+GV56L5HdTzikkYEyN4Zu06DLhqeA4ZGU2zSdO xqg8r4YvahdzpJY4eJ6JN5HrS168KEjRANFMlsbFdouu1Ioovr0QEZj/D5QTIAhg7aqQ32Evn Y8rziQ40MrPf2X0MCbUVj3cpMFNj9NWA8xj4NmuIFHToKR6wCmtpvJpPn4o7hGRaw31lSoP7y 24iJDfGK8RZ/nHi7tGw2yoW/A+QuPPoi9F7jkN4g8p4z0g8Ypxal/Fi+O03lPvkcJjIxzZ+fH Mo9wvQPjTrGC8vdh2sRGXfJ2ImZ6brf27fMM1x/IOW8MfyExNe63kgAStR6R88i42ek+puLpQ Ni0FGA==
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author