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

Re: "typeset -p" and no_GLOBAL_EXPORT, other misc.



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