source .bashrc
my .bashrc is not executed after starting terminal. I have to manually source .bashrc everytime. Is this normal or am I missing something?
my .bashrc is not executed after starting terminal. I have to manually source .bashrc everytime. Is this normal or am I missing something?
Do you have a file (probably ~/.bash_profile, but maybe ~/.profile) that include the line:
source ~/.bashrc
~/.bashrc is only read automatically by non-interactive shells.
When starting a new sessions, bash looks for .bash_profile, .bash_login, .profile (in that order) and uses the first one it finds.
If you are already in a session, and start a subshell, then that bash will read .bashrc
This is a way of speeding up the setting of things that are not inherited when starting a subshell.
The typical approach is to have your .bash_profile (or .bash_login, or .profile) source your .bashrc
...
...
...
if [[ -e $HOME/.bashrc ]]; then
source $HOME/.bashrc
fi
...
...
...source .bashrc