我的 ~/.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/