如何在os x中重新加载所有bash启动文件?

jua*_*tas 0 bash

我可以重新加载顺序http://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout/source,但有一个短的路?

我的意思是,一个命令按顺序加载所有文件,而不是:

source /etc/profile
source ~/.bash_profile
source ~/.bashrc
source ~/.bash_login
source ~/.profile
Run Code Online (Sandbox Code Playgroud)

Swi*_*iss 7

它可能不是最好的,但这里有一个快速的方法来资源一切:

exec bash -l
Run Code Online (Sandbox Code Playgroud)

-l部队的bash作为一个登录shell,这应该source/etc/profile文件的工作.


kiz*_*zx2 5

把这个放在你的 ~/.bashrc

rld() {
  source /etc/profile
  source ~/.bash_profile
  source ~/.bashrc
  source ~/.bash_login
  source ~/.profile
}
Run Code Online (Sandbox Code Playgroud)

现在,您可以rld随时重新加载所有这些文件。