Zsh/Bash 启动文件加载顺序 (.bashrc, .zshrc etc.)
https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/
linux系统里有各种启动加载文件:
.bashrc、.bash_profile、.bash_login、.profile 等,事实上,这里的文件并不是都会被用到,这取决于是以何种方式进入系统
对bash,读取顺序如下表所示,先执行A,然后B,然后C , B1,B2,B3的意思是,按顺序读取最先读到的一个。
| Interactive login | Interactive non-login | Script | |
|---|---|---|---|
| /etc/profile | A | ||
| /etc/bash.bashrc | A | ||
| ~/.bashrc | B | ||
| ~/.bash_profile | B1 | ||
| ~/.bash_login | B2 | ||
| ~/.profile | B3 | ||
| BASH_ENV | A | ||
| ~/.bash_logout | C |
从tty登录和通过ssh远程登录,就是 login shell
以 docker exec -it container bash 方式进入容器的,输入 non-login 的 shell

浙公网安备 33010602011771号