Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #178224

Re: The same environment variables everywhere

From Nicolas George <george@nsup.org>
Newsgroups linux.debian.user
Subject Re: The same environment variables everywhere
Date 2017-02-27 19:20 +0100
Message-ID <tfy3T-TW-1@gated-at.bofh.it> (permalink)
References (3 earlier) <tfoxz-2Ks-5@gated-at.bofh.it> <tfoHg-2QD-11@gated-at.bofh.it> <tftxg-68T-5@gated-at.bofh.it> <tfwYa-b8-9@gated-at.bofh.it> <tfxKx-vQ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Le nonidi 9 ventôse, an CCXXV, Teemu Likonen a écrit :
> I moved my variable assignments to ~/.environment.sh and source that to
> ~/.profile and ~/.xsession.

Zsh has a ~/.zshenv that is meant exactly for that. It is sourced by all
zsh instances, even those started as interpreters. It is very
convenient. I just have to make sure that ~/.xsession is a #!/bin/zsh
script, and it automatically gets the environment.

I start mine with:

[[ "$ZSHENV_USER" == $UID-1 ]] && return
export ZSHENV_USER=$UID-1

That way, I avoid re-sourcing the file if it has already been sourced by
an ancestor. Thus, I can change the environment of a subtree of
processes without having it overridden, but the environment is
re-sourced if I ever use su. The "-1" can be changed to force
re-sourcing the file by new shells, but I do not use it anymore.

I do not know what shell systemd uses to start user programs: the user's
login shell or /bin/sh. If it is the former, then it works for that case
too.

Regards,

-- 
  Nicolas George

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-26 13:30 +0100
  Re: The same environment variables everywhere Matthias Bodenbinder <matthias@bodenbinder.de> - 2017-02-26 21:00 +0100
    Re: The same environment variables everywhere Stefan Monnier <monnier@iro.umontreal.ca> - 2017-02-27 06:00 +0100
      Re: The same environment variables everywhere deloptes <deloptes@gmail.com> - 2017-02-27 09:10 +0100
        Re: The same environment variables everywhere <tomas@tuxteam.de> - 2017-02-27 09:20 +0100
          Re: The same environment variables everywhere GiaThnYgeia <GiaThnYgeia@openmailbox.org> - 2017-02-27 12:40 +0100
            Re: The same environment variables everywhere Elimar Riesebieter <riesebie@lxtec.de> - 2017-02-27 13:40 +0100
          Re: The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 14:30 +0100
            Re: The same environment variables everywhere David Wright <deblis@lionunicorn.co.uk> - 2017-02-27 18:10 +0100
              Re: The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 19:00 +0100
                Re: The same environment variables everywhere Nicolas George <george@nsup.org> - 2017-02-27 19:20 +0100
                systemd service environment Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 19:50 +0100
          Re: The same environment variables everywhere deloptes <deloptes@gmail.com> - 2017-02-27 19:30 +0100
  Re: The same environment variables everywhere Greg Wooledge <wooledg@eeg.ccf.org> - 2017-02-27 14:20 +0100

csiph-web