@kevin This is for Bash specifically. Each shell works a bit differently.

For login shells (interactive or not), it runs `/etc/profile`, then `~/.bash_profile`, `~/.bash_login`, and `~/.profile`.

For interactive non-login shells, it runs `~/.bashrc`.

For non-interactive non-login shells, you have to set `BASH_ENV` to a script to run before you run Bash. You need to give the full path of the script, I think.

If you are running a script or command over sshd (rather than logging in and interacting with commands as usual), it'll run `~/.bashrc`.

Here's the doc page: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html