Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Mysterious (debug?) output in loop
- X-seq: zsh-users 28847
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: dominik.vogt@xxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Mysterious (debug?) output in loop
- Date: Sun, 29 Jan 2023 21:20:56 +0100
- Archived-at: <https://zsh.org/users/28847>
- In-reply-to: <Y9bTcNA8Har0xT6L@localhost>
- List-id: <zsh-users.zsh.org>
- References: <Y9bTcNA8Har0xT6L@localhost>
On Sun, Jan 29, 2023 at 9:19 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> 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?
That's what `local` does by default. You can `setopt typeset_silent`
to disable this (I always do in all my scripts).
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author