mac os 中的 .bashrc 和 .bash_profile

Posted by on | |

本來只記得login之後,系統會跑bash shell,
也就會自動執行,.bashrc 和 .bash_profile 這二個檔案,
今天移機到新mac時,想說,有些指令先設定到.bashrc中,
結果毎次開啟terminal,設定的竟然沒有執行,
查了一下,原因請看這一篇囉!

.bash_profile vs .bashrc



基本上,mac os是個例外,它無論如何,都是執行.bash_profile,
所以在.bash_profile裡頭,來設定執行的.bashrc

在 .bash_profile 加入這一段:
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

0 意見: