102-500 Exam QuestionsBrowse all questions from this exam

102-500 Exam - Question 76


Which of the following files is not read directly by a Bash login shell?

Show Answer
Correct Answer: A

When a Bash login shell starts, it reads and executes commands from specific initialization files in a set order. It first looks for /etc/profile, and then checks for ~/.bash_profile, ~/.bash_login, and ~/.profile. It will read and execute commands from the first file it finds among these that exists and is readable. The file ~/.bashrc, on the other hand, is typically read during the invocation of a non-login interactive shell. Thus, the file ~/.bashrc is not read directly by a Bash login shell.

Discussion

8 comments
Sign in to comment
LazylinuxOption: A
Apr 18, 2022

It is read as part of interactive non-login shell and hence to directly referenced Read from the BIBLE :) https://learning.lpi.org/en/learning-materials/102-500/105/105.1/105.1_01/

Lazylinux
Apr 22, 2022

i mean by saying hence NOT directly referenced

sigi63Option: A
Dec 2, 2020

B (if available) + E are only read in when logging on to the system. C is an alternative of B and is only read if B is not present. D is only read at logon if neither B nor C is present. A is the correct answer! Book page 299 Harald Maaßen "LPIC-1 Secure for successful Linux certification".

claudiodzOption: A
Mar 28, 2021

(A) is definitely correct, see source: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

McLaba
Apr 23, 2021

infact bash read the config files in this order.. /etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile, at the exit -> ~/.bash_logout

Jodelo
Jul 6, 2021

This is absolutely true

MaikyCR28
Jun 5, 2022

Well done. Just mention that ~/.profile is only read if ~/.bash_profile and ~/.bash_login aren't present.

HieuNguyen887Option: A
May 12, 2021

The correct answer is A

lindoswinuxOption: A
Sep 13, 2020

answer is A

kullstone
Sep 17, 2020

Correct, ~/.bashrc read directly from Interactive shell, not Bash Login Shell. https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

germanb
Oct 14, 2020

Correct answer, "/home/user/.bashrc executes (sourced from the user’s .bash_profile or .profile)" it's not read from bash_login

t33h9ckOption: A
Mar 7, 2021

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. When an interactive login shell exits, or a non-interactive login shell executes the exit builtin command, Bash reads and executes commands from the file ~/.bash_logout, if it exists. So the correct Answer is A which read with a bash non-login shell

yigidoOption: D
Sep 3, 2020

correct answer is D

ismael_1_Option: E
Sep 16, 2020

the correct is E