当我创建新的终端窗口或关闭终端并重新打开它时,我的 .bash_login 文件没有加载。我必须运行:
源 ~/.bash_login
每次都是为了让我在 .bash_login 中的别名起作用。知道为什么吗?
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.
./bash_login
每当您登录时读取(重新启动计算机,重新启动桌面或连接到远程计算机等)并且创建新终端未登录。如果您想在每次打开新终端时加载别名,则需要将它们取而代之/.bashrc
。