Initialization Files
profile:
- used for all login shells
- guard bash/sh specific stuff
bashrc:
- interactive bash shells
- sourced by profile
alias, functions:
- sourced by profile
- guard bash specific stuff
env:
- all environment configuration
- sourced by profile
- guard bash specific stuff
$BASH_ENV:
- set to .env
- used by non-interactive bash
$ENV:
- set to .shinit
- used by interactive sh
Evaulation Order
sh:
- Login: /etc/profile, ~/.profile
- Interactive (login & non-login): $ENV
bash:
- Login: /etc/profile, ~/.bash_profile
- Interactive (non-login): ~/.bashrc
- Non-interactive: $BASH_ENV
- Logout: ~/.bash_logout
ksh:
- Login: /etc/profile, ~/.profile
- Interactive (login & non-login): $ENV
zsh:
- Login: /etc/zshenv, ~/.zshenv, /etc/zprofile, ~/.zprofile, /etc/zshrc, ~/.zshrc, /etc/zlogin, ~/.zlogin
- Interactive: /etc/zshenv, /etc/zshrc, ~/.zshrc
- Logout: ~/.zlogout, /etc/zlogout