更新时间:2022-05-21 09:28:36
我觉得你很困惑这个问题。我担心这可能是关于登录shell与非登录shell。看到bash手册页的精细打印...这促使我过去的笨蛋。
I think you are confusing the issue. I fear this may be about login shells versus non-login shells. See the bash manual page for the fine print ... which has driven me bonkers in the past.
这就是说,如果你可以在系统范围内设置环境变量,有几个选项:
That said, if you can set environment variables system-wide, you have a few options:
/ etc / environment
是一个非常好的地方如果您使用不同的shell 〜/ .local_bashrc
添加。 〜/ .local_bashrc
来自和/或全部
/etc/environment
is a very good place as it is shell-agnostic should you ever use a different shell~/.local_bashrc
the add . ~/.local_bashrc
from and and all of
〜。/ bashrc
〜/ .bash_profile
~./bashrc
~/.bash_profile
等pp。
您可以使用来自FILE 的 echo Hello(源文件)替换FILE与文件的名称。这显示了从登录开始的shell之间的差异(例如通过
gdm
等),通过 ssh
连接,通过新的 xterm
等终端等等。
You can precede the sourcing with a echo Hello from FILE
where you replace FILE with the name of the file. That shows you the difference between shells starting from login (eg via gdm
et al), via ssh
connection, via new xterm
etc terminals and so on.