views:

805

answers:

2

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.

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

Any ideas?

EDIT:

I created this little script (screen_bash.sh):

bash --rcfile ~/.screen_bashrc

Then added

shell $HOME/screen_bash.sh

To my .screenrc

The ~/.screen_bashrc file was

<my_setup_stuff>
export SHELL=bash

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

+1  A: 
screen bash --rcfile yourfile.rc

yourfile.rc should source .bashrc.

EDIT: This doesn't really do what you want, I just realised you probably want it to apply to all shells started by screen.

Michiel Buddingh'
Thanks - I put your suggestion in my .screenrc using the shell command (as described above) and it worked.
Greg Reynolds
+2  A: 

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.

swampsjohn
Thanks - this and the other answer sorted me out.
Greg Reynolds
can you post the answer. I have the same question and I am still not sure how to invoke my ~/.bash_profile from .screenrc
Nadal