How do I get a custom Gnu screen configuration for loading .bash_profile and .bash_aliases?

I have a custom screen configuration myscreenconfigand .screenrc. myscreenconfigas follows:

source .screenrc
screen 0 bash
title 'notes' 
screen 1 bash
title 'bash' 
[etc.]

.screenrc has these lines at the top:

altscreen on
shell -${SHELL}

My .bash_profilefile sets a lot of things and then calls source $HOME/.bash_aliases.

If I start screenwithout any arguments, mine .bash_profileloads and boots .bash_aliases. But if I run the screen through screen -c myscreenconfig, it only loads .bash_profile, not .bash_aliases. What for? How can i fix this?

+3
source share
4 answers

Since you are not using login shells in myscreenconfig. Use (IIRC) screen 0 -bashor try combinations with deflogin on.

0

, , bash .bashrc( ):

ln -s ~/.bash_profile ~/.bashrc
+3

I had the same problem on one of the machines that I use. After reading the sentence above about linking to two bash resource files, I realized that the following section was put in a comment in a .bash_profile file on this particular machine:

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

After deleting the comment marks (#) to line lines if, the settings in the .bashrcscreen are also available.

+2
source

I use this in my .bashrc

if [ "$TERM" = "screen" ]; then
        if [ -f ~/.bash_profile ]; then
                . ~/.bash_profile
        fi
fi
0
source

Source: https://habr.com/ru/post/1783619/


All Articles