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


Groups > linux.debian.user > #224657

Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell

From Nate Bargmann <n0nb@n0nb.us>
Newsgroups linux.debian.user
Subject Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell
Date 2020-07-09 20:40 +0200
Message-ID <AqJCG-6uD-29@gated-at.bofh.it> (permalink)
References <ApWiC-1Op-11@gated-at.bofh.it> <ApWiC-1Op-9@gated-at.bofh.it> <AqhQ5-6y9-1@gated-at.bofh.it> <AqisN-705-7@gated-at.bofh.it>
Organization Amateur Radio!

Show all headers | View raw


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

* On 2020 08 Jul 08:38 -0500, Greg Wooledge wrote:
> There are lots of choices here.  And this is with only the login shell
> layer involved -- no X11 or Wayland.

Good points and it must be emphasized that ~/.profile or ~/.bash_profile
are for *login* shells only.  Ordinarily shells started from a GUI
terminal emulator are not login shells though there is usually an option
that can be ticked to invoke the shell as a login shell.

> That's interesting, but I'm not sure I fully trust that test you
> performed.  I don't know whether the "Run Command dialog" is doing
> something secretly.  I'd prefer to check the actual starting environment
> of one of the GNOME processes.  I don't know what their names are, but
> assuming you can find one that looks like it was started at the time
> you logged in, grab its PID and then do something like this:
> 
> tr \\0 \\n < /proc/its_pid_here/environ | grep your_variable_here
> 
> That will show you the initial environment of that process, without
> letting "Run Command" get involved to do any tricky stuff.
> 
> If it turns out that the Wayland session really does dot in ~/.profile,
> that's yet another reason why you need to ensure that it remains
> shell-neutral.  I would imagine that Wayland dots it in from a POSIX
> shell (the same way the Debian X11 session dots in ~/.xsessionrc from
> a POSIX shell).

My test was not exhaustive, but I did run your command and with Gnome on
Wayland and any variables I had set in ~/.profile appeared in the
environment of processes running as my username such as gnome-shell.
Trying the same on a Buster VM with Xfce on Xorg showed that variables
set in ~/.profile did not appear in the environment of a running process
such as xfce4-panel or xfdesktop.

Most likely Debian uses dash to source the ~/.profile and ~/.xsessionrc files

A quick test shows that Gnome on Wayland does not source ~/.xsessionrc,
however Gnome on Xorg does appear to source both ~/.profile and
~/.xsessionrc (tested from a cold start).  In this case it is my guess
that it is Gnome that is sourcing ~/.profile independent of the GUI
environment it is running on.

I think this is as far down this road as I care to go!

- Nate

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819

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


Thread

How To Permanently Add-to a Users PATH Statement in the Bash Shell "Stephen P. Molnar" <s.molnar@sbcglobal.net> - 2020-07-07 16:00 +0200
  Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Roberto C. Sánchez <roberto@debian.org> - 2020-07-07 16:10 +0200
    Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Jonathan Dowland <jon+debian-user@dow.land> - 2020-07-07 16:20 +0200
      Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Greg Wooledge <wooledg@eeg.ccf.org> - 2020-07-07 16:40 +0200
        Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Zenaan Harkness <zenaan@freedbms.net> - 2020-07-08 02:10 +0200
          Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Roberto C. Sánchez <roberto@debian.org> - 2020-07-08 02:30 +0200
            Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell David Wright <deblis@lionunicorn.co.uk> - 2020-07-08 06:50 +0200
          Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Andrei POPESCU <andreimpopescu@gmail.com> - 2020-07-08 07:30 +0200
      Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Nicolas George <george@nsup.org> - 2020-07-07 16:40 +0200
    Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Nicolas George <george@nsup.org> - 2020-07-07 16:20 +0200
  Fw: How To Permanently Add-to a Users PATH Statement in the Bash Shell Matthew Campbell <trenix25@pm.me> - 2020-07-07 16:10 +0200
  Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Greg Wooledge <wooledg@eeg.ccf.org> - 2020-07-07 16:20 +0200
    Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Zenaan Harkness <zenaan@freedbms.net> - 2020-07-08 02:10 +0200
    Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Zenaan Harkness <zenaan@freedbms.net> - 2020-07-08 02:50 +0200
      Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Andrei POPESCU <andreimpopescu@gmail.com> - 2020-07-08 07:30 +0200
        Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Greg Wooledge <wooledg@eeg.ccf.org> - 2020-07-08 13:50 +0200
          Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Zenaan Harkness <zenaan@freedbms.net> - 2020-07-08 14:50 +0200
  Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Nate Bargmann <n0nb@n0nb.us> - 2020-07-08 15:00 +0200
    Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Greg Wooledge <wooledg@eeg.ccf.org> - 2020-07-08 15:40 +0200
      Re: How To Permanently Add-to a Users PATH Statement in the Bash  Shell Nate Bargmann <n0nb@n0nb.us> - 2020-07-09 20:40 +0200

csiph-web