Oracle Solaris 11 Advanced System Administrator — Question 16

A user brian is configured to use the bash shell. His home directory is /export/home/brian, and contains a .profile and a .bashrc file.
In the -profile, there are these lines:
genius =ritchie
export genius
In the .bashrc us this line:
genius=kernighan
In /etc/profile are these lines:
genius=thompson
export genius
When brian logs in and asks for the value of genius, what will he find, and why?

Answer options

Correct answer: C

Explanation

The correct answer is C, as the variable settings in .profile take precedence over those in .bashrc. When brian logs in, the .profile is executed first, setting genius to ritchie, and since .bashrc does not overwrite this value afterwards, it remains ritchie. Options A and B are incorrect interpretations of the order of execution, while D misstates the execution order, and E incorrectly claims that /etc/profile overrides local settings.