nerdexam
Oracle

1Z0-100 · Question #63

Bash is invoked as an interactive login shell. What is the order in which the bash configuration files are read, assuming that all the files exist in their correct location and are readable?

The correct answer is C. /etc/profile, ~/ .bash_profile, ~/ .bash_login, ~/ .profile. 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…

Manage Users and Groups

Question

Bash is invoked as an interactive login shell. What is the order in which the bash configuration files are read, assuming that all the files exist in their correct location and are readable?

Options

  • A/etc/profile, ~/ .profile
  • B/etc/profile, ~/ .bash_profile
  • C/etc/profile, ~/ .bash_profile, ~/ .bash_login, ~/ .profile
  • D/etc/profile, ~/ .bash_profile, ~/ .profile, ~/ .bash_login

How the community answered

(30 responses)
  • A
    3% (1)
  • B
    10% (3)
  • C
    80% (24)
  • D
    7% (2)

Explanation

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 a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it

Topics

#bash#login shell#profile files#configuration order

Community Discussion

No community discussion yet for this question.

Full 1Z0-100 Practice