On Tue, Dec 06, 2011 at 07:43:18AM +0100, Matthias Lederhofer wrote:
> Nicholas Marriott <nicholas.marri...@gmail.com> wrote:
> > Well, not necessarily, ksh for example does not export PWD.
> 
> I could not verify this (on openbsd):
> 
>     matled@openbsd:~% ksh

If you start PWD with it already in the environment, it is marked as
exported - this is the same as any other variable:

$ export FOO=1
$ env|grep FOO
FOO=1
$ ksh
$ FOO=2
$ ksh
$ env|grep FOO
FOO=2

Make ksh your user's shell or unset PWD and try :-). It will not export
PWD unless you ask it to.

>     $ cd /tmp/b
>     $ env |grep ^PWD
>     /tmp/b
>     $ sh -c pwd
>     /tmp/b
>     $ env -i sh -c pwd
>     /tmp/a
> 
> > > What do you mean by the last two paragraphs?  I think every new
> > > session should be the same, in the current implementation the first
> > > session is special as the environment variables of this session are
> > > used for all later sessions.
> > > 
> > 
> > Well, to be more precise, the global environment is set from the client
> > which starts tmux and that is used for ALL sessions, including the first
> > one. So all sessions are the same, modulo update-environment.
> > 
> > We have to set the global environment up somehow, either copying from
> > the first client or starting empty.
> > 
> > The point is that if we copy the whole environment into the session
> > environment for new sessions, the hierarchy of global environment <
> > session environment is lost.
> 
> My tmux usage is that I start it almost every time I start a terminal
> emulator (urxvt).  I'm using it especially because I can run tmux from
> a specific directory and start a new shell in the same directory very
> easily without the need to type the path again.  I don't have a fixed
> sets of tmux sessions running at all times, it may just happen that I
> close all terminal emulators and did not detach from any session.
> After that, starting the first tmux session again is nothing I do
> deliberately, it just happens from time to time.
> 
> In this scenario I do not understand yet what a global environment is
> needed for.  I find it more intuitive and sufficient to have one

For your use, you want to be able to add * to
update-environment. Particularly if that included PWD too.

* should match anything, -* should remove anything in the new but not
global environment add an unset (-FOO) for anything that is in the
global environment but not the new.

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to