[CentOS] screen not sourcing .bashrc

Tue Aug 26 12:21:50 UTC 2008
Filipe Brandenburger <filbranden at gmail.com>

On Tue, Aug 26, 2008 at 02:14, Matt Arnilo S. Baluyos (Mailing Lists)
<matt.baluyos.lists at gmail.com> wrote:
> I use the "screen" command from time to time and what i would still
> have to figure out how to do is for it to be able to source .bashrc
> and read my user-defined configuration (aliases for example).

Screen opens a "login shell", which means it will only read
.bash_profile and not .bashrc. However, that is the same kind of shell
that you have when you open a Konsole/Terminal/rxvt/xterm window, or
when you log in to the console, or when you open a SSH session, so is
it that only your screen sessions don't source .bashrc while the
others all do?

To have the desired effect of reading .bashrc always, it's common (and
the default) that your .bash_profile contains the following lines:

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

Did you remove these?

> I have already added the "source /root/.bashrc" line on
> /root/.screenrc but it doesn't seem to be working.

No, this is not going to work, since .screenrc accepts screen
commands, not bash commands.

> Would anyone know how this should work?

This should work. Try removing your .screenrc (or renaming to a backup
name) and seeing if it works after you do.

If it still does not work, post the contents of ~/.bash_profile,
~/.bashrc, ~/.screenrc and maybe also /etc/profile, /etc/bashrc and
/etc/screenrc, and then we may be able to help you some more.

HTH,
Filipe