一句话,.bash_profile是登陆后的环境变量,.bashrc是未登录的
when working with Linux, Unix, and Mac OS X, I always forget which bash config file to edit when I want to set my PATH and other environmental variables for my shell. Should you edit .bash_profile or .bashrc in your home directory?
You can put configurations in either file, and you can create either if it doesn’t exist. But why two different files? What is the difference?According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.
ref:http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html