bashrc居然没有被自动的加载让我很吃惊, yahoo之后找到了办法如下:
I figured out this diagram by adding echo "${BASH_SOURCE[0]}"
to those scripts.
+-----------------+ +------FIRST-------+ +-----------------+
| | | ~/.bash_profile | | |
login shell -------->| /etc/profile |-->| ~/.bash_login ------>| ~/.bashrc |
| | | ~/.profile | | |
+-----------------+ +------------------+ +-----------------+
+-----------------+ +-----------------+
| | | |
interactive shell -->| ~/.bashrc -------->| /etc/bashrc |
| | | |
+-----------------+ +-----------------+
+-----------------+
| |
logout shell ------->| ~/.bash_logout |
| |
+-----------------+
Note
-
[]-->[]
meanssource by workflow
(Automatically). -
[--->[]
meanssource by convention
(Manually. If not, nothing happen.). -
FIRST
meansfind the first available, ignore rest
what does your .bash_profile look like? I just set mine up with the following in my .bash_profile, and it's working.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export PS1='\[\e[0;31m\]\u\[\e[0m\]\[\e[1;31m\]@\[\e[0m\]\[\e[0;31m\]\H\[\e[0m\] \w $ '
source ~/.bashrc