Re: GNU Bash shell startup files

"Jamenson Espindula" ([email protected] via blfs-dev Mailing List) <[email protected]> Sat, 17 Jan 2026 03:24:33 -0300
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <CAOW_YOm7Agk6i08N75CjC1EHCa5eYS61KjaYc2Gr957Yhh0F6Q@mail.gmail.com>
Em sex., 16 de jan. de 2026 às 12:44, Pierre Labastie
<[email protected]> escreveu:
>
> We have ~/.profile for the case when the shell is invoked as "sh" (so-
> called POSIX mode). In this case, ~/.profile is the only personal file
> that is read.
> For the problem with completions, I think you need to manually source
> /etc/profile when using a non login shell. ~/.profile does not source
> files in /etc/profile.d anyway...
>
After well understanding the sequence Bash sources the files (by
eliminating all confusion in my mind), I had an idea of (locally, in
my own scripts) moving from '/etc/profile' to '/etc/bashrc' the
following piece of code:

 = = = Transcription begins = = =

for script in /etc/profile.d/*.sh ; do
        if [ -r $script ] ; then
                . $script
        fi
done

unset script

 = = = Transcription ends = = =

'/etc/bashrc' is the _last file sourced_ by Bash, after a successful
login and after a 'su' without the '--login' option. Furthermore, I
have included the following piece of code:

 = = = Transcription begins = = =

for script in /etc/bash_completion.d/* ; do
        if [ -r $script ] ; then
                . $script
        fi
done

unset script

 = = = Transcription ends = = =

That last one is intended to source the completions from Ville Skyttä
<https://github.com/scop/bash-completion/> (Editor Notes suggestion).

According to my knowledge, such a configuration works outside the GNU
Screen (on the TTY) and inside the GNU Screen.

If that configuration causes any problems with other shells, please let me know.

I suggest the above changes to the default files of the Beyond Linux
From Scratch.

Thank you all.

Jamenson Espindula

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page