Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sharing environment between terminals.
On Sun, 18 Nov 2012 10:35:14 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 17, 4:39pm, Ray Andrews wrote:
> }
> } Is there a way to instantly share environment variables between running
> } terminals?
>
> Generally speaking, no. The environment of each process is private to
> that process, allocated by the operating system at the time the process
> is forked.
>
> If desperate enough, you could set up something using the zsh/tcp module
> to have your shells cooperatively swap new environment strings around.
> One shell (or an external daeamon of some kind -- condsider the model
> used by ssh-agent) would have to control the "master" environment, and
> hand out changes to the other shells on request. The other shells would
> check at opportune times (during precmd for example) whether changes are
> available, and apply them.
It might be easier to intercept typeset etc. and turn them into shell
functions that save the environment. You'd probably need to do some
fairly nifty history-style timestamping to ensure you didn't simply
reimport the entire environment each time, however --- particularly to
ensure you got the latest results over all shells.
Hmm, I wonder if doing something clever examining the actual saved
history (with INC_APPEND_HISTORY set) would help?
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author