Bash doesn't read .bashrc unless manually started
In .bash_profile make sure you have the following:
# .bash_profile
# If .bash_profile exists, bash doesn't read .profile
if [[ -f ~/.profile ]]; then
. ~/.profile
fi
# If the shell is interactive and .bashrc exists, get the aliases and functions
if [[ $- == *i* && -f ~/.bashrc ]]; then
. ~/.bashrc
fi
Why would it source it? You are not running true bash
:
$ echo $SHELL
/bin/sh
In most modern systems sh
is a symlink to a basic shell. On my Debian for example:
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Aug 1 2012 /bin/sh -> dash
In your case, sh
is a link to bash
but, as explained in man bash
:
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. [...] When invoked as an interactive shell with the name sh, bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect.
and
--norc
Do not read and execute the system wide initialization file /etc/bash.bashrc and the personal initialization file ~/.bashrc if the shell is interactive. This option is on by default if the shell is invoked as sh.
So, since your default shell is sh
, .bashrc
is not read. Just set your default shell to bash using chsh -s /bin/bash
.