From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: sharing environment between terminals.
Date: Sun, 18 Nov 2012 11:22:40 -0800 [thread overview]
Message-ID: <50A93580.60500@eastlink.ca> (raw)
In-Reply-To: <121118103514.ZM2913@torch.brasslantern.com>
On 18/11/12 10:35 AM, Bart Schaefer 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.
>
Most of that sounds way above my head for the moment. But I did get it
working quite well using, as you suggest, precmd(). Basically, I have a
command that sets whatever env. variable and also writes a script that
can set that variable. precmd() sources that script, which adds the
variable to the local env of any xterm.
I use this to create shortcuts to the current directory on each xterm.
'$t0' being automatically set to the current dir on 'pts/0', etc. I can
then change to a different terminal and do stuff like:
cp ./* $t0
cd $t5
mv $t2/* $t3
etc.
... which saves a lot of typing.
Still, I would have thought that there would be an easy way to share
stuff between xterms. I think of my xterms as different windows into the
same house--I want them to share everything--history, environment,
everything.
next prev parent reply other threads:[~2012-11-18 19:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-18 0:39 Ray Andrews
2012-11-18 18:35 ` Bart Schaefer
2012-11-18 19:22 ` Ray Andrews [this message]
2012-11-18 19:33 ` Peter Stephenson
2012-11-18 23:11 ` Ray Andrews
2012-11-19 0:22 ` Phil Pennock
2012-11-19 16:23 ` Ray Andrews
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A93580.60500@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).