From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: dominik.vogt@gmx.de, Zsh Users <zsh-users@zsh.org>
Subject: Re: Mysterious (debug?) output in loop
Date: Mon, 30 Jan 2023 11:12:38 +0100 [thread overview]
Message-ID: <CAKc7PVBqiRwdfXKCKLY=cM_916uDPWa7fVeVDHw6oA-=E_BOCw@mail.gmail.com> (raw)
In-Reply-To: <Y9bTcNA8Har0xT6L@localhost>
[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]
You can find some other useful options here:
https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#std-options
niedz., 29 sty 2023, 21:19 użytkownik Dominik Vogt <dominik.vogt@gmx.de>
napisał:
> 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
>
>
[-- Attachment #2: Type: text/html, Size: 1654 bytes --]
prev parent reply other threads:[~2023-01-30 10:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 20:13 Dominik Vogt
2023-01-29 20:20 ` Roman Perepelitsa
2023-01-29 20:22 ` Bart Schaefer
2023-01-30 10:12 ` Sebastian Gniazdowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKc7PVBqiRwdfXKCKLY=cM_916uDPWa7fVeVDHw6oA-=E_BOCw@mail.gmail.com' \
--to=sgniazdowski@gmail.com \
--cc=dominik.vogt@gmx.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).