当我创建新的终端窗口或关闭终端并重新打开终端窗口时,我的.bash_login文件未加载。我必须跑:
source~ / .bash_login
每次为了使.bash_login中的别名都能正常工作。知道为什么吗?
答案 0 :(得分:1)
./bash_login
(重新启动计算机,重新启动桌面或连接到远程计算机等),并且创建新终端时没有登录。如果要在每次打开时加载别名新终端,您需要将它们放在/.bashrc
中。
答案 1 :(得分:1)
你有〜/ .bash_profile文件吗?如果是这样,它将优先使用〜/ .bash_login。从bash手册页:
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.