When bash is started as a login shell (either interactive or non-interactive), it does the following:
- Executes the system startup file
/etc/profile - Executes the first user startup file it finds:
a.
~/.bash_profileb.~/.bash_loginc.~/.profile
The --noprofile option prevents both steps above.
When bash is started as a non-login shell that is interactive, it executes
~/.bashrc.
The --norc option prevents this.
The --rcfile file specifies a different file to be executed instead of
~/.bashrc.
When a login bash shell exits, it executes ~/.bash_logout