当我远程连接到我的Ubuntu系统时,.bashrc并没有被加载。我之所以知道这一点,是因为.bashrc末尾的行根本不运行,不过如果我在登录. .bashrc后手动点源,它们就不会运行。我查看了/etc/skel并检查了.profile等,还在用户/home/myuser/.profile中看到了用于.bashrc的加载程序行。下面是/home/myuser/.profile中的行(我正在使用myuser从远程Putty.exe主机登录到系统中)。为什么.bashrc不像我从Putty登录到系统时那样加载,/home/myuser/.profile应该加载正确吗?
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi发布于 2022-07-29 08:53:28
Ubuntu不运行.bashrc。对于Ubuntu,gnome-terminal通常不作为登录壳运行,因此.bashrc应该直接运行。
对于登录shell(如虚拟终端),通常运行文件~/.profile,除非您有~/.bash_profile或~/.bash_login,但默认情况下它们不在那里。默认情况下,Ubuntu只使用.profile。
https://askubuntu.com/questions/1298476
复制相似问题