当我启动 bash 终端时,我的 .profile 没有被执行。我没有 ~/.bash_profile 或 ~/.bash_login,所以 .profile 应该运行,对吗?还有什么问题?
Ric*_*lka 26
它不是登录外壳。
如果 shell 是登录 shell,它将查找 .bash_profile(如果存在),然后查找 .profile。其他 shell 查找 .bashrc
所以,你可以把你想要的东西放在 .bashrc 中的每个 shell 实例中,并且可能在 .profile 中有一个引用 .bashrc。
所以:.bashrc:
stuff you want
Run Code Online (Sandbox Code Playgroud)
.profile 结尾:
[ -n "$BASH" ] && [ -f ~/.bashrc ] && . ~/.bashrc
Run Code Online (Sandbox Code Playgroud)