linux - 在 linux 屏幕中保留我的环境

标签 linux bash screenrc

我的 ~/.bash_profile 中有几个自定义的环境变量和函数,我希望在使用 screen -D -R 开始我的屏幕 session 时自动调用它们,但显然添加了 source ~/.bash_profile in ~/.screenrc 没有解决我的问题。

在每个新屏幕上,我都必须手动获取 bash_profile。

我注意到在创建新屏幕时找不到该文件(当您创建新屏幕时,底部有一行显示正在执行的命令,它返回找不到文件。 )

最佳答案

~/.bash_profile 仅由登录 shell 运行。

~/.bashrc 由其他交互式 shell 运行,例如由 screen 启动的 shell。

~/.screenrc是屏幕配置文件,不用于配置bash。

将每个 shell 应该设置的东西放在 ~/.bashrc 中,并将 source ~/.bashrc 添加到你的 ~/.bash_profile

关于linux - 在 linux 屏幕中保留我的环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27157420/

相关文章:

windows - 在 Windows 机器上开发,在 Linux (Ubuntu) 上部署

linux - 将 rpm 文件转换为 debian 错误(包构建失败)

.net - 如何从 .NET Core 应用程序调用 native Linux 和 OS X API?

linux - 使用 session 名称命名 screen session 日志

linux - screenrc 中的 shell 命令

linux - rasm 和 ndisasm

bash - 为什么通过 ssh 传递带有引号空格的命令不起作用?

bash:防止重定向函数的错误与输出混合

Bash 重定向运算符 sed 命令

gnu-screen - 如何在 GNU Screen hardstatus 中显示之前选择的选项卡?