zsh-workers
 help / color / mirror / code / Atom feed
From: Shane Squires <shane2squires@gmail.com>
To: zsh-workers@zsh.org
Subject: "export FOO" twice behaves differently than "export FOO" once
Date: Sat, 21 Mar 2020 14:35:35 -0700	[thread overview]
Message-ID: <CAPkN6apJ+V44uOfnvOuWTWwg6SE1i_pVu+ifQh3MhwbjPuy=tw@mail.gmail.com> (raw)

[-- 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

             reply	other threads:[~2020-03-21 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21 21:35 Shane Squires [this message]
2020-03-25 23:33 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPkN6apJ+V44uOfnvOuWTWwg6SE1i_pVu+ifQh3MhwbjPuy=tw@mail.gmail.com' \
    --to=shane2squires@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).