|
作者 Sonia
|
|
和Bash的環境設定有關的檔案有 - /etc/profile (主要)
- $HOME/.bash_profile (主要)
- $HOME/.bash_login
- $HOME/.profile
- $HOME/.bash_logout (主要)
- $HOME/.bashrc (主要)
- /etc/bashrc
- 先執行 /etc/profile
- 接著bash會檢查使用者的自家目錄中,是否有 .bash_profile 或者 .bash_login 或者 .profile,若有,則會執行其中一個,執行順序為:
- .bash_profile 最優先
- .bash_login其次
- .profile 最後
這三個檔案只有在登入時,才會被bash讀取- 登出(exit/logout)時
bash會檢查使用者自家目錄中是否有 .bash_logout,若有,則bash會執行其中的指令
- 登入後啟動一個新的 shell :
此時我們稱之為一個 subshell, 也就是說在命令列中鍵入 bash, 除了原先登入時的bash 之外, 又另外啟動了一個新的 bash shell. bash 會檢查使用者的自家目錄中是否有 .bashrc,若有則予以執行
|