Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of custom settings in my bash_profile. when I use gnu-screen, I realized that my screens do not execute source /Users/disappearedng/.bash_profile. I try to put source /Users/disappearedng/.bash_profile in my .screenrc file but then it complains that alias is not a command... (I guess that screenrc needs screenrc specific command).

I have tried changing my .bash_profile to .profile or .bash_rc. None of that work.

Any help?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

The .bash_profile file (and .profile file as well) is loaded for login shells, non-login shells use .bashrc (no _ symbol). There is a line in the .screenrc file that tells screen what shell to spawn when starting a screen window (when not launching a specific program as the window application). In my .screenrc file, this is as such (including comments as well):

# 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

Check your .screenrc file and verify that the shell line has the dash in front of it. By having that dash symbol and forcing a login shell, you'll get your .bash_profile sourced. The $SHELL variable in my .screenrc is using the shell value as provided by the shell that launches screen (generally for me it's bash).

In case you're wondering, the biggest difference that I've been able to discover between login versus non-login shells is that a non-login shell is normally what's invoked for executing scripts.

share|improve this answer
    
Ah thanks! In addition, is there a way to easily let myself know that this current window is inside gnu screen? –  disappearedng Jul 24 '11 at 22:46
    
the hardstatus option in the .screenrc file can be used to help with making sure that you can identify that you are in screen (along with some other nifty settings too I understand). The screen man page should have the details on how to configure it (don't know those off the top of my head). –  Matrix Mole Jul 24 '11 at 22:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.