Re: GNU Bash shell startup files
"Jamenson Espindula" ([email protected] via blfs-dev Mailing List) <[email protected]> Fri, 16 Jan 2026 11:39:37 -0300
| Newsgroups | gmane.linux.lfs.beyond.devel |
|---|---|
| Message-ID | <CAOW_YO=ecdonwdg-a1SG7A1WA9iWkBVhfZ-mPB2Th-YmbPFnTA@mail.gmail.com> |
Em sex., 16 de jan. de 2026 às 10:07, Xi Ruoyao <[email protected]> escreveu: > > As you've put the echo line at the end of the file, if one file sources > another, you'll see a reversed order. > > For example, in the "su --login" case: > > 1. bash reads /etc/profile, executes it, and prints "/etc/profile." > 2. bash reads .bash_profile, which sources .bashrc, and it only prints > ".bash_profile" after finishing .bashrc. > > As your deduction is already completely wrong here, I'll not waste more > time to read further. > Well done! Sorry. Update: I put an "echo" at the beginning of every file too. Below is the result: Successful login reading file '/etc/profile' read file '/etc/profile' reading file '/root/.bash_profile' reading file '/root/.bashrc' reading file '/etc/bashrc' read file '/etc/bashrc' read file '/root/.bashrc' read file '/root/.bash_profile' su reading file '/root/.bashrc' reading file '/etc/bashrc' read file '/etc/bashrc' read file '/root/.bashrc' Some conclusions (updated): Conclusion one: regardless if it be 'login shell' or a 'non-login shell', the '$HOME/.bashrc' and '/etc/bashrc' files _are always read_ and in that order. Conclusion two: the '$HOME/.bash_profile' is the _first personal file read_ after a successful login using the program '/usr/bin/login' (Note: confirmed by bash(1) manual page: 'When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior'). After Bash has found the '~/.bash_profile' file, '~/.bash_login' and '~/.profile' are not read. Conclusion three: the '$HOME/.profile' file is _not read_ at all (considering the defaults of the Beyond Linux From Scratch). Conclusion four: was completely wrong in the Original Post. Meanwhile, inside the GNU Screen (which fits into the 'non-login shell' category), the 'completions' of the GNU Bash are not working (considering the 'stock' files). My best guess is (updated): source the '$HOME/.profile' (in the '$HOME/.bashrc' file) (which should contain the proper source commands of the bash completions). Jamenson Espindula -- http://lists.linuxfromscratch.org/sympa/info/blfs-dev Unsubscribe: See the above information page