运行bash初始化脚本的GNU屏幕 [英] GNU Screen running a bash init script

查看:55
本文介绍了运行bash初始化脚本的GNU屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以肯定在屏幕手册中对此有答案,但是我找不到它! 我希望由GNU屏幕生成的bash shell除了已经运行的.bashrc之外,还可以从文件中获取源代码.

I'm sure there is an answer to this in the manual to screen, but I can't find it! I want the bash shell spawned by GNU screen to source in a file in addition to the .bashrc that it already runs.

我无法调用.bashrc中的文件,因为在我们的网站上,.bashrc文件在登录时会自动重新生成.

I can't put a call to the file in .bashrc because on our site .bashrc files get regenerated automatically on login.

有什么想法吗?

我创建了这个小脚本(screen_bash.sh):

I created this little script (screen_bash.sh):

bash --rcfile ~/.screen_bashrc

然后添加

shell $HOME/screen_bash.sh

到我的.screenrc

To my .screenrc

〜/.screen_bashrc文件是

The ~/.screen_bashrc file was

<my_setup_stuff>
export SHELL=bash

SHELL = bash是必需的,以便像vim这样的程序可以正确启动子shell.

The SHELL=bash is necessary so that programs like vim can launch sub-shells correctly.

推荐答案

您是否希望每次打开新屏幕窗口时都源此文件?如果是这样, shell 命令可让您覆盖在创建新的屏幕窗口时运行(默认情况下仅为$ SHELL).您可以将其设置为最终运行您的Shell的脚本.

Do you want this file to be sourced every single time a new screen window is opened? If so, the shell command allows you to overwrite what is run when you create a new screen window (by default it's just $SHELL). You can set this to be a script of your choice that at the end runs your shell.

这篇关于运行bash初始化脚本的GNU屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆