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

Re: autoload variables



On Mon, Aug 30, 2021 at 8:22 AM Anthony Fletcher <anthony@xxxxxxxx> wrote:
>
> Can I autoload these variables as needed?

It would require at least as much overhead to record when and from
where to load the variables as it does to have them defined.

Related to what Roman suggested, you coud also place the variables in
ordinary autoload functions that you run when you need to initialize
them.  Use e.g.

typeset -gx UPIF=$(ip -4 r | sed -n -e '/^default/ s/^default.*dev //;
s/ .*// p;q' )

to have the variable become a global export instead of locals.




Messages sorted by: Reverse Date, Date, Thread, Author