我一直在研究 bash 的工作原理,到目前为止我已经了解了以下内容:
启动登录 shell 时,将执行以下存在的第一个文件:
~/.bash_profile
, ~/.bash_login
,~/.profile
当启动交互式的非登录 shell(或子 shell)时,该~/.bashrc
文件将被执行。
此外,.profile 还可以由 sh 等其他 shell 执行。我现在的问题是,拥有 .bash_profile 和 .bash_login 有什么意义?它们都执行相同的功能,并且与 .profile 不同,.bash_profile 和 .bash_login 都只能由 bash 读取。我知道它们之间的唯一区别是,如果 .bash_profile 不存在,则 .bash_login 会被执行。那么为什么它会在那里呢?
bash ×1