Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "typeset -p" and no_GLOBAL_EXPORT, other misc.
- X-seq: zsh-workers 52737
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: "typeset -p" and no_GLOBAL_EXPORT, other misc.
- Date: Tue, 12 Mar 2024 20:58:53 +0000
- Archived-at: <https://zsh.org/workers/52737>
- In-reply-to: <CAH+w=7b3OyC8bDfcN46LH-p8Dk6dWnS_JjYMgd9R2mngxwm__w@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAH+w=7YBMPe_6qZPt8-CR_EhJPGbnyiNNAguGcWiD3K7nLtB9A@mail.gmail.com> <20240312084926.d6vbk75ozud7i2jm@chazelas.org> <CAH+w=7Z40c_8k1FHra0K9iQvih=4LZmS-pkx06o_CiDf0wTJJQ@mail.gmail.com> <20240312202653.p2bbwbpxcfazzgpj@chazelas.org> <CAH+w=7b3OyC8bDfcN46LH-p8Dk6dWnS_JjYMgd9R2mngxwm__w@mail.gmail.com>
2024-03-12 13:38:48 -0700, Bart Schaefer:
[...]
> > but I find that export / typeset -x seem to
> > behave like typeset -gx in that they don't make the variable
> > local.
>
> Yes, that's GLOBAL_EXPORT in action, as in the subject of this thread.
> They're still exactly like each other, I didn't say they were like
> some other shell's export or that they acted like -r.
Sorry, most of your initial post went way over my head, I just
reacted to the last sentence to warn against the "bash way" in
this regard and make sure that -g remains more for "non-local"
than "global" (whatever that means such as outermost-scope in
bash).
[...]
> > To have a local export variable, it seems you need
> > typeset var; typeset -x var or typeset var; export var instead
> > of typeset -x var.
>
> Just
> typeset +g -x var
[...]
Thanks.
Also fine with me for +g to cancel an implicit -g that would
mean non-local.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author