0

当我创建新的终端窗口或关闭终端并重新打开它时,我的 .bash_login 文件没有加载。我必须运行:

源 ~/.bash_login

每次都是为了让我在 .bash_login 中的别名起作用。知道为什么吗?

4

2 回答 2

1

Do you have a ~/.bash_profile file? If so, it'll use that in preference to ~/.bash_login. From the bash man page:

When  bash  is invoked as an interactive login shell, or as a non-
interactive shell with the --login option, it first reads and exe-
cutes  commands  from  the file /etc/profile, if that file exists.
After  reading  that   file,   it   looks   for   ~/.bash_profile,
~/.bash_login,  and  ~/.profile, in that order, and reads and exe-
cutes commands from the first one that  exists  and  is  readable.
The  --noprofile  option  may be used when the shell is started to
inhibit this behavior.
于 2012-09-27T00:03:01.100 回答
1

./bash_login每当您登录时读取(重新启动计算机,重新启动桌面或连接到远程计算机等)并且创建新终端未登录。如果您想在每次打开新终端时加载别名,则需要将它们取而代之/.bashrc

于 2012-09-26T21:40:34.633 回答