mac terminal not auto load bashrc

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

  1. []-->[] means source by workflow (Automatically).
  2. [--->[] means source by convention (Manually. If not, nothing happen.).
  3. FIRST means find 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

你可能感兴趣的:(mac terminal not auto load bashrc)