Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: export



In general a process, whether it is a zsh or other program, cannot affect
the environment of any other program. It can only provide the initial state
for a new program that it executes. That is what is happening in your
example. You are interacting with a zsh process spawned by a xterm. In that
zsh process you modify its environment. You then spawn a new shell which
inherits a private copy of that environment.

There is no way to modify the private copy a given process has of its
environment.

On Tue, Nov 25, 2014 at 9:43 PM, Kurtis Rader <krader@xxxxxxxxxxxxx> wrote:

> 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.
>
> On Tue, Nov 25, 2014 at 9:07 PM, Ray Andrews <rayandrews@xxxxxxxxxxx>
> wrote:
>
>> On 11/25/2014 08:32 PM, Bart Schaefer wrote:
>>
>>> On Nov 25,  4:57pm, Ray Andrews wrote:
>>> } Subject: export
>>> }
>>> } When I export a variable it is only available in subsequent shells in
>>> } the same xterm. Can I make it export globally?
>>>
>>>
>> You guys don't understand what I'm asking.  I know I can't pass
>> variables 'backwards' (except via a file), but when I export, the
>> variable will be available  in *subsequent* shells but only in the
>> same xterm:
>>
>>         pts/2 HP-y5--5-Debian1 root /aWorking/Zsh $ export trash=TRASH
>>
>>         pts/2 HP-y5--5-Debian1 root /aWorking/Zsh $ zsh
>>
>>         pts/2 HP-y5--5-Debian1 root /aWorking/Zsh $ echo $trash
>>         TRASH
>>
>> ... export does what it should do, but *only* in the same xterm.
>> If I now go to another xterm, $trash is not set:
>>
>>         pts/9 HP-y5--5-Debian1 root /boot/Clone/y8--5-Debian2 $ zsh
>>
>>         pts/9 HP-y5--5-Debian1 root /boot/Clone/y8--5-Debian2 $ echo
>> $trash
>>
>>
>>
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>



-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank


Messages sorted by: Reverse Date, Date, Thread, Author