One important distinction is that bash_profile is read when you loggin whereas bashrc is read each time you open a bash shell after youve logged in.
bash_profile是在用户login时用到的, 而bashrc是在每次启动一个新的 terminal时调用的。
例如:
但我login主机之后,从新开一个terminal(会看到bashrc执行的结果,但没有看到bash_profile执行的个结果)并运行如下命令,
1 >ps
2 PID TTY TIME CMD
3 29455 pts/8 00:00:00 bash
4 29758 pts/8 00:00:00 ps
5 sonora.peking.corp.mr.com: /home/user
6 >tty
7 /dev/pts/8
8 sonora.peking.corp.mr.com: /home/user
9 >who
10 user pts/1 2014-01-17 04:38 (wifi-143-182.peking.corp.mr.com)
11 user pts/3 2014-01-15 05:54 (wifi-143-182.peking.corp.mr.com)
12 user tty1 2014-01-13 05:08 (:0)
13 user pts/5 2014-01-16 01:56 (wifi-143-182.peking.corp.mr.com)
14 user pts/9 2014-01-17 04:44 (wifi-143-182.peking.corp.mr.com)
通过who的结果和tty的结果,发现,重新打开一个新的terminal时,并没有建立新的链接,但不确定真的区别有哪些??