有没有办法通过bash_profile"资源"而无需重启终端?

use*_*249 9 bash .bash-profile

我经常需要对我进行更改~/.bash_profile,并且我必须重新启动终端以进行更改传播.是否有任何命令可以重新启动我的命令~/.bash_profile

Wil*_*ill 9

是的,你可以运行:

source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

要么:

. ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

这将重新加载/重新源于.bash_profile当前shell.

~/.bash_profile为方便起见,我把这个命令放在我身上:

alias reprofile='source ~/.bash_profile'
Run Code Online (Sandbox Code Playgroud)

然后我只是键入reprofilerepro TAB.