When bash is invoked as an interactive login shell, which of the following sentences is true?
A.
It first reads and executes commands in /etc/profile and then does same for ~/.bash_profile and ~/.bashrc
B.
It first reads and executes commands in /etc/bashrc and then does same for /etc/profile
C.
It reads and executes commands in ~/.bashrc only if /etc/profile or another initialization script calls it.
D.
It ignores /etc/profile and only reads and executes commands in ~/.bashrc
E.
It first reads and executes commands in /etc/profile and then does same for ~/.bash_profile, ~/.bash_login and ~/.profile
Looks like E is the best choice.
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.
http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
man is all of our 🙂
I think you are correct “E” is the correct anaswer.
correct answer is C
for ~/.bash_profile, ~/.bash_login, and ~/.profile BASH reads and executes commands from THE FIRST ONE that exists and is readable… not from all of them