How to force Gnu screen to load my bash .profile

11,339

Solution 1

shell -$SHELL

Add the above line to your ~/.screenrc, this will make screen start-up using a login shell which will load your ~/.bash_profile.

Solution 2

Some Mac applications rely on .bash_profile and some on .bashrc. I have not figured out any particular rule for knowning which one is getting loaded but for consistency this is my .bash_profile:

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Share:
11,339

Related videos on Youtube

Nadal
Author by

Nadal

Updated on September 17, 2022

Comments

  • Nadal
    Nadal almost 2 years

    I have ~/.bash_profile which I would like to be invoked every single time a new GNU screen is created so that all my aliases work in GNU screen as they work in terminal.

    At this time this is what my ~/.screenrc looks like.

    hardstatus on
    hardstatus alwayslastline
    hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
    
    • Nadal
      Nadal about 14 years
      I solved this problem by moving all the contents of ~/.bash_profile to ~/.bashrc. Apparently screen invokes ~/.bashrc before each window.
  • theonlygusti
    theonlygusti over 7 years
    This stops screen starting in the current directory. How do I make screen start in the current directory?