Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "export FOO" twice behaves differently than "export FOO" once



Shane Squires wrote on Sat, 21 Mar 2020 14:35 -0700:
> I wanted to report some unusual behavior with the export command.  This is
> for the usage where a variable is exported without being given a value.
> Exporting a variable twice seems to add it to the environment, but
> exporting it once does not.  See shell output below.
> 
>  % echo $ZSH_VERSION
> 5.3.1
>  % unset FOO
>  % export FOO
>  % /usr/bin/env | grep FOO
>  % export FOO
>  % /usr/bin/env | grep FOO
> FOO=
> 
> Is this an expected behavior?  I can see an argument for either behavior
> (either adding FOO to the environment or not adding it) when no value is
> given.  But it seems like the behavior should be consistent whether
> exporting once or twice.

I'm not sure whether it's expected, but I can reproduce it in master.

Thanks,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author