Bash Configuration Files: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 16: Line 16:
  │
  │
  │
  │
  └─→ ~/.bash_profile ─→ ~/.bash_login ─→ ~/.profile
  └─→ ~/.bash_profile ─→ ~/.bash_login ─→ ~/.profile <font color=teal># executes the first one that exists and it is readable</font>
</font>
</font>
<font color=darkgray>When more than one of <code>~/.bash_profile</code>, <code>~/.bash_login</code> or <code>~/.profile</code> exists and it is readable, the first one, in this order, is executed.</font>
<font color=darkkhaki>TODO: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html</font>


=Interactive Non-Login Shell=
=Interactive Non-Login Shell=

Revision as of 04:02, 22 November 2021

External

Internal

Overview

This article describes how bash executes its startup files. If any of the files exist, but cannot be read, bash reports an error.

Interactive Login Shell

This sequence is executed by an interactive login shell, or a shell that was invoked with --login:

├─→ /etc/profile ─→ /etc/profile.d/*.sh
│
│
└─→ ~/.bash_profile ─→ ~/.bash_login ─→ ~/.profile # executes the first one that exists and it is readable

When more than one of ~/.bash_profile, ~/.bash_login or ~/.profile exists and it is readable, the first one, in this order, is executed.

TODO: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

Interactive Non-Login Shell

Non-Interactive Shell

Invoked with the name "sh"

Invoked by Remote Shell Daemon

Invoked with Unequal Effective and Real UID/GIDs