如何在 os x 中重新加载所有 bash 启动文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/11568649/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to reload all bash startup files in os x?
提问by sites
I could reload them in this order http://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout/with source, but there is a short way?
我可以重新加载顺序http://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout/用source,但有一个短的路?
I mean, a command that loads all files in its order, and not to do:
我的意思是,一个按顺序加载所有文件的命令,而不是执行以下操作:
source /etc/profile
source ~/.bash_profile
source ~/.bashrc
source ~/.bash_login
source ~/.profile
回答by Swiss
It may not be the best, but here is a quick way to resource everything:
它可能不是最好的,但这里有一个快速获取所有资源的方法:
exec bash -l
The -lforces bash to work as a login shell, which should source /etc/profile.
该-l势力抨击工作作为登录shell,这应该source / etc / profile文件。
回答by kizzx2
Put this in your ~/.bashrc
把这个放在你的 ~/.bashrc
rld() {
  source /etc/profile
  source ~/.bash_profile
  source ~/.bashrc
  source ~/.bash_login
  source ~/.profile
}
Now you can go rldwhenever you want to reload all those files.
现在,您可以rld随时重新加载所有这些文件。

