Re: Defining variables in the caller's environment (was: ERR_RETURN ignored in 'if' in a source'd file [FIXED])

Bart Schaefer <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <CAH+w=7YBvTnka1vXqYiPOLopSCQxtC+9N_Rjej9UhkJcpfZSQQ@mail.gmail.com>
On Tue, May 20, 2025 at 3:52 AM Roman Perepelitsa
<[email protected]> wrote:
>
> In Zsh 5.10 and above, $( ... ) can be replaced with ${ ... } to avoid forking.
>
>     function define-vars() {
>       local -A var1=("$1" "$2")
>       local -i var2=42
>       typeset -p -- var1 var2
>     }

Also
  eval ${ define-vars 'x' 'y $ z' }

Which is an idiom in use for many years, e.g.
  eval $(ssh-agent)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.