Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: More rabbit-holes with unset variables
- X-seq: zsh-workers 47641
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Subject: Re: More rabbit-holes with unset variables
- Date: Thu, 26 Nov 2020 13:29:03 -0600
- Archived-at: <https://zsh.org/workers/47641>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-11/CAMP44s098pf-4TicpWRhTtx%3DVkjQ6kCE8LeGNA4-CbAyNt1kkA%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-wr1-f45.google.com) smtp.remote-ip=209.85.221.45; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2cwlUDovxOQ3Z2lVjJcCw9Rg3vEhk6SaY+La/zP6Zi4=; b=fJQ51FwzT4l2RDMF5SKrYngR8y4v6OHO7N/S/VyPmEooD3dCxXopwxS8tDrEC7/n1U AtuE+cgbqWnz8WqnbS5EZLC8VGRmhseVd9RDqNiy38APJU3bJUWR6Q/9243SDw4CBhJY G5rshP7jCOQoIBlaywFvyBaDBRB8kEl2f5kl6S2BTV8h31ZoSM8exBu2txGKrG4xcu25 dN8ZEltj5AvbimW7KjDXRn9jHshnrBrizrxLkpEL/1pqrEEqQuDOpawHGcIPjhK9XB/C V71yy6My473nAWhaLLuB5AXU6E+G9FJE4QS+nQkODndlW1IhzJlDVkuPuaoK1XXr9Psp 4ayg==
- In-reply-to: <86243-1606389706.499549@-gQx.nNYG.4Z3k>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <CAH+w=7Zag5MG5D=cRS2UMSsqJ0t=iw5MH9j8=HBO1Q77nbs03w@mail.gmail.com> <20201125131921.vay7h3xk5qn4odgg@chazelas.org> <CAMP44s0-ki=TBzTwnqx10FcTLX4mbphwN88UCx0+h97JTecBWA@mail.gmail.com> <20201126061029.in5tpnrg5bplam5k@chazelas.org> <CAMP44s1XgxdDAAL+7nL3_GK=dZUasPmSWZaKqWg0T-v5iq1eYg@mail.gmail.com> <86243-1606389706.499549@-gQx.nNYG.4Z3k>
- Sender: zsh-workers-request@xxxxxxx
On Thu, Nov 26, 2020 at 5:21 AM Oliver Kiddle <opk@xxxxxxx> wrote:
> It appears that export VAR will not export an empty VAR even in zsh
> (unless you do VAR=""). So zsh's not exactly consistent.
> typeset [-x] is arguably just a variant of export.
That is a good point. Why does zsh return nil in this case?
typeset -x FOO
sh -c 'echo ${FOO-nil}'
> Felipe Contreras wrote:
> > The discussion is about what "typeset var" (with no type) should do.
>
> That is not "with no type", it has the default type which effectively is
> a string. Other shells also treat such variables as an empty string for
> the purposes of other features. Try += for example.
I mean the user specified no type.
What each shell implementation decides to do with that depends, but
the user specified no type. Yes, it makes sense to use string as the
default type, but some weird shell implementation might decide not to.
Cheers.
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author