zsh-workers
 help / color / Atom feed
* "export FOO" twice behaves differently than "export FOO" once
@ 2020-03-21 21:35 Shane Squires
  2020-03-25 23:33 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Shane Squires @ 2020-03-21 21:35 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

Hi, zsh workers--

First of all, zsh is fantastic, so thanks for maintaining it.

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.

Note that the same behavior is not true in bash, for example:

bash-4.3$ echo $BASH_VERSION
4.3.0(1)-release
bash-4.3$ unset FOO
bash-4.3$ export FOO
bash-4.3$ /usr/bin/env | grep FOO
bash-4.3$ export FOO
bash-4.3$ /usr/bin/env | grep FOO

Let me know if you need any additional information.  Thanks--
Shane

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "export FOO" twice behaves differently than "export FOO" once
  2020-03-21 21:35 "export FOO" twice behaves differently than "export FOO" once Shane Squires
@ 2020-03-25 23:33 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2020-03-25 23:33 UTC (permalink / raw)
  To: Shane Squires; +Cc: zsh-workers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 21:35 "export FOO" twice behaves differently than "export FOO" once Shane Squires
2020-03-25 23:33 ` Daniel Shahaf

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git