profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bash_profile by exiting and logging back in but I would like to be able to do it on demand.


Simply type source ~/.bash_profile

Alternatively, if you like saving keystrokes you can type . ~/.bash_profile . ~/.bash_profile


. ~/.bash_profile

只要确保你没有任何对当前状态的依赖。


Simply type:

. ~/.bash_profile

However, if you want to source it to run automatically when terminal starts instead of running it every time you open terminal, you might add . ~/.bash_profile . ~/.bash_profile to ~/.bashrc file.

Note:

When you open a terminal, the terminal starts bash in (non-login) interactive mode, which means it will source ~/.bashrc .

~/.bash_profile is only sourced by bash when started in interactive login mode . That is typically only when you login at the console (Ctrl+Alt+F1..F6), or connecting via ssh .

链接地址: http://www.djcxy.com/p/4316.html

上一篇: 从Python运行shell命令并捕获输出

下一篇: 命令行中的配置文件?