From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1707 invoked by alias); 26 Nov 2014 18:14:09 -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: 19448 Received: (qmail 17479 invoked from network); 26 Nov 2014 18:13:57 -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 X-Authority-Analysis: v=2.1 cv=AduIQRnG c=1 sm=1 tr=0 a=p9xhtsQbFeWP+Dk8WftIHA==:117 a=p9xhtsQbFeWP+Dk8WftIHA==:17 a=G8GL833Es-AA:10 a=IkcTkHD0fZMA:10 a=B8c6TojbBI-LoZxmVv4A:9 a=QEXdDO2ut3YA:10 Message-id: <54761157.8040406@eastlink.ca> Date: Wed, 26 Nov 2014 09:43:51 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.2.0 MIME-version: 1.0 To: Zsh Users Subject: Re: export References: <54752574.5090205@eastlink.ca> <141125203249.ZM18877@torch.brasslantern.com> <54756007.6060800@eastlink.ca> In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit All: > Each process gets a private copy of the environment provided by its > parent. An xterm is just a process. In your example you have this chain > of processes (parent => child): > > xterm => zsh => zsh > > There is no way for an arbitrary zsh process to affect the environment > of an arbitrary xterm process. Yeah, I understand the 'inheritance'. I just thought that 'export' might somehow be ramped up to overcome that. We certainly can do what I want, it's just a little bit of trouble: universal() { echo "$1" >>! /tmp/universal; . /tmp/universal } And in .zshrc: preexec () { [ -e /tmp/universal ] && . /tmp/universal } Now in xterm #6: pts/6 HP-y5--5-Debian1 root /aWorking/Zsh $ universal "trash=trash" pts/6 HP-y5--5-Debian1 root /aWorking/Zsh $ echo $trash trash Now hop over to xterm #12: pts/12 HP-y5--5-Debian1 root /aWorking/Zsh $ echo $trash trash ... so we can universally export instantly. I normally have four xterms open at the same time, so being able to do that is very handy. The above is obviously rather crude, but it's simple and it works. And you can throw a command in there too. As Kurtis said, it might be dangerous, but I live on the edge ;-) ----------------------- >FYI, the "fish" shell does that. >set -U universal its value >and that $universal variable (here an array) becomes available >in all the fish shells (interactive or not) by the same user on >the machine (with all the security implications it entails). That's very cool, I think we should have it too.