When is /etc/bash.bashrc invoked?
From Debian's bash
README
:
What is
/etc/bash.bashrc
? It doesn't seem to be documented.The Debian version of bash is compiled with a special option (
-DSYS_BASHRC
) that makesbash
read/etc/bash.bashrc
before~/.bashrc
for interactive non-login shells. So, on Debian systems,/etc/bash.bashrc
is to~/.bashrc
as/etc/profile
is to~/.bash_profile
.
Technically, /etc/bash.bashrc
is invoked for interactive, non-login bash shells for all users.
However, usually /etc/profile
(which is invoked for all login shells) calls /etc/bash.bashrc
as well. So that means /etc/bash.bashrc
is also invoked for all logins shells as well.
However, the first line usually checks quits if non-interactive.
So in the end, effectively /etc/bash.bashrc
is executed for all interactive bash shells (login and non-login). Think of it as the system-wide ~/.bashrc