Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell
On Wed, Jul 08, 2020 at 07:39:40AM -0400, Greg Wooledge wrote:
> On Wed, Jul 08, 2020 at 10:44:39AM +1000, Zenaan Harkness wrote:
> > - XFCE acts as, or uses, Dash or something that does not propagate shell functions in the parent env
>
> There are many layers involved. Assuming you're logging in with a "Debian
> X session", a POSIX shell (sh) is used to read most of the config files
> for the Xsession stuff. Bash extensions like exporting functions won't
> be possible at that point.
>
> > - so launch startx, figuring out over many failures to start "modern" "sessions"
>
> Yeah, as I keep saying to others on this list, the entire login paradigm
> is different when you use startx vs. a display manager. Testing one by
> using the other is not going to work.
>
> With a console+startx login, your session is begun by an interactive
> login shell (probably bash). Tricks like exporting functions into the
> environment with the intent to make them available in all of your future
> xterms *will* work from here.
>
> They *won't* work from a display manager login, though.
>
> With a DM login, you have a bunch of sh scripts (which aren't even login
> shells) that can export variables but *not* functions. You don't get
> a bash shell until you actually open a terminal.
>
> None of your shell's dot files are used at all, until you open a terminal,
> and then *only* .bashrc gets read (unless you configure your terminal
> to run a login shell -- which some people do, just to make things even
> *more* difficult to explain and diagnose).
>
> > - but alas, XFCE would not propagate shell functions
>
> It's not XFCE per se. It's the fact that a display manager was used for
> the initial login. Even if you configure it to run a single gigantic
> xterm and nothing else.
>
> On Wed, Jul 08, 2020 at 08:24:56AM +0300, Andrei POPESCU wrote:
> > On Mi, 08 iul 20, 10:44:39, Zenaan Harkness wrote:
> > > - so try somewhere in the session startup apps - nope, courdn't
> > > figure it out at least
> >
> > For Debian you want ~/.xsessionrc
>
> Do note, as I mentioned on the wiki, that ~/.xsessionrc is read by
> a POSIX shell, and you can't use bashisms in it.
>
> unicorn:~$ grep -r USERXSESSIONRC /etc/X11
> /etc/X11/Xsession.d/40x11-common_xsessionrc:if [ -r "$USERXSESSIONRC" ]; then
> /etc/X11/Xsession.d/40x11-common_xsessionrc: . "$USERXSESSIONRC"
> /etc/X11/Xsession:USERXSESSIONRC=$HOME/.xsessionrc
>
> See, the ~/.xsessionrc file is dotted in (by a POSIX shell). It's not
> executed as a program. So you can't just change the shebang on it, or
> anything like that.
>
> If the goal is to export bash functions into the environment for the
> entire session, honestly, sticking with console + startx is the best
> approach.
Some useful hints there, thank you.
But, snigger moan, xfce-session is "special". No dice on the bashisms (admittedly, about 4 yrs since I looked). You see, XFCE Just Wurked™©® for a number of things, and I like that nostalgic WindowsXP feel it gives (<SHAME>I know, I know, brown paper bag firmly planted on head...</SHAME>).
Reply to: