Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with unset variables
On Wed, Nov 11, 2020 at 7:03 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> And what is the reason why this is not the default?
I don't know, I'm fairly new to zsh myself. All I can say is that the
behavior of zsh feels more natural to me.
> Not only does this behavior differ from all other shells, but
> basically all languages.
All languages? That seems exaggerated. How about this?
int var;
How many languages will set `var` to null here? Is it all of them?
In the morally-equivalent shell code, bash does but zsh doesn't:
typeset -i var
echo $var
I don't know which of these languages conforms to the majority opinion
but neither can claim to do what *all* languages do.
FWIW, I rely on this behavior of zsh in my code (namely, that `typeset
-i var` sets `var` to 0).
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author