It’s always a bit confusing to reason about which startup files bash
(1) is going to run in a given situation. It is documented, but the logic is not trivial.
So I made a chart (using PlantUML!). You’re welcome.
EDIT: There is also one for zsh
(1) (PlantUML).
The main takeaway from this exercise is:
In
sh
mode,bash
andzsh
do slightly different things.
Bash

Zsh
Sure enough, as soon as I shared this post. Someone chimed in asking for a version for zsh
(1). As I suspected, it is equally hairy, but certainly different in incompatible ways.

Update 2023-03-13: Fixed confusion between zshrc
(interactive) and zlogin
(login).
Leave a Reply