Re: Scripts in the '/etc/profile.d/' directory

"Jamenson Espindula" ([email protected] via blfs-dev Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <CAOW_YO=tk2+OgMNTCeh3DDT_r2_Vm=B_OqOZr7L+2qrYpTXv7A@mail.gmail.com>
Em qua., 24 de set. de 2025 às 00:07, Bruce Dubbs
<[email protected]> escreveu:
>
> I think there are times when using a display manager, ~/.bash_profile is not run, so
> the /etc/profile.d/ scripts are not run.  If that is the case then I think ~/.bashrc
> does need something like 'if some-condition; then ~/.bash_profile; fi' or whatever
> the program that does the login needs to run 'bash --login'.
>
> You do NOT want .bashrc to run the /etc/profile.d/ scripts every time it is invoked.
>
>    -- Bruce
>
>
> --
> http://lists.linuxfromscratch.org/sympa/info/blfs-dev
> Unsubscribe: See the above information page

I have a 'more elegant' solution!

I did remember that I faced that situation and I wrote a little text
(never published) about.

First, you create a '.screenrc' file in your home directory.

Second, you put the following inside that file:
defshell -"${SHELL}"

Explanations:

The environment variable 'SHELL' will be expanded by GNU Screen. The
value of that environment variable should be '/usr/bin/bash'.

Note the minus sign '-' ahead of the environment variable: it tells
the GNU Screen to initiate a 'login shell', as if 'bash --login' had
been invoked. The result is '-/usr/bin/bash', a 'login shell' that
reads the '/etc/profile' file and, by consequence, all the scripts in
the '/etc/profile.d/' directory!

Jamenson Espindula

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.