我的 bash_profile 中有一堆自定义设置。当我使用 gnu-screen 时,我意识到我的屏幕不执行source /Users/disappearedng/.bash_profile. 我尝试将 source /Users/disappearedng/.bash_profile 放在我的 .screenrc 文件中,但随后它抱怨 alias 不是命令......(我猜 screenrc 需要特定于 screenrc 的命令)。
我曾尝试将我的 .bash_profile 更改为 .profile 或 .bash_rc。这些都不起作用。
有什么帮助吗?
小智 18
.bash_profile 文件(以及 .profile 文件)是为登录 shell 加载的,非登录 shell 使用 .bashrc(没有 _ 符号)。.screenrc 文件中有一行告诉 screen 在启动屏幕窗口时(当不将特定程序作为窗口应用程序启动时)生成哪个 shell。在我的 .screenrc 文件中,是这样的(也包括评论):
# shell: Default process started in screen's windows.
# Makes it possible to use a different shell inside screen
# than is set as the default login shell.
# If begins with a '-' character, the shell will be started as a login shell.
shell -$SHELL
Run Code Online (Sandbox Code Playgroud)
检查您的 .screenrc 文件并验证 shell 行前面是否有破折号。通过使用破折号并强制登录 shell,您将获得 .bash_profile 来源。我的 .screenrc 中的 $SHELL 变量使用由启动屏幕的 shell 提供的 shell 值(通常对我来说它是 bash)。
如果您想知道,我能够发现登录 shell 与非登录 shell 之间的最大区别是非登录 shell 通常是为执行脚本而调用的。
| 归档时间: |
|
| 查看次数: |
4736 次 |
| 最近记录: |