Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: 'export FOO' not idempotent
On Mon, Jun 27, 2022, at 5:11 PM, Michael Smith wrote:
> Environments tested:
> - macOS 12.4, M1 chip, zsh 5.8.1 (x86_64-apple-darwin21.0)
> - Ubuntu 20.04.4, zsh 5.8 (x86_64-ubuntu-linux-gnu)
>
> If I repeat 'export FOO' to mark an environment variable not give it a
> value, in bash it consistently does not show up in 'env':
> $ export FOO
>
> $ env | grep FOO
>
> $ export FOO
>
> $ env | grep FOO
>
>
> but in zsh the 2nd invocation will set it to an empty string:
> $ export FOO
>
> $ env | grep FOO
>
> $ export FOO
> $ env | grep FOO
>
> FOO=
This was discussed in workers/47531 and the ensuing thread.
https://www.zsh.org/mla/workers/2020/msg01350.html
It was resolved in zsh 5.9 with the introduction of the TYPESET_TO_UNSET
option, but as per workers/47545, "[t]his is a long standing feature
of zsh, so the default behaviour is not going to change."
https://www.zsh.org/mla/workers/2020/msg01364.html
> This is an issue only because a project I'm building uses an empty
> export for documentation, and it makes that project annoying to work
> with.
Depending on a variable to be exported but unset is a curious design
decision to say the least.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author