From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5608 invoked by alias); 18 Nov 2012 19:52:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17413 Received: (qmail 12873 invoked from network); 18 Nov 2012 19:52:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.eastlink.ca designates 24.224.136.9 as permitted sender) X-Authority-Analysis: v=2.0 cv=FqZdZBXq c=1 sm=1 a=bWgGDZnfoeonEsxmbE2SBg==:17 a=-1ZKr4ocusoA:10 a=ZZQV8jkXHa0A:10 a=8nJEP1OIZ-IA:10 a=_lcLBkvvF3UA:10 a=JdLNyrqu3Dw2uZqxPB4A:9 a=wPNLvfGTeEIA:10 a=bWgGDZnfoeonEsxmbE2SBg==:117 Message-id: <50A93580.60500@eastlink.ca> Date: Sun, 18 Nov 2012 11:22:40 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: sharing environment between terminals. References: <50A82E58.4020104@eastlink.ca> <121118103514.ZM2913@torch.brasslantern.com> In-reply-to: <121118103514.ZM2913@torch.brasslantern.com> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit 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.