用戶以bash登錄時(shí)捶枢,會(huì)執(zhí)行一系列啟動(dòng)腳本。
/etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile
用戶退出bash時(shí),會(huì)執(zhí)行清理腳本。
~/.bash_logout
用戶使用非bash登錄時(shí),然后切換到bash乏矾,會(huì)執(zhí)行配置腳本。比如迁杨,登錄時(shí)時(shí)sh钻心,然后切換到bash。
~/.bashrc
不同啟動(dòng)腳本具有不同的應(yīng)用范圍铅协。
- /etc/profile - 系統(tǒng)啟動(dòng)腳本捷沸。所有用戶登錄時(shí),都會(huì)執(zhí)行警医。
- ~/.bash_profile - 用戶啟動(dòng)腳本亿胸。用戶登錄時(shí),執(zhí)行自己目錄下的啟動(dòng)腳本预皇。
- ~/.bashrc - 用戶配置腳本侈玄。當(dāng)從非bash切換到bash時(shí),執(zhí)行用戶目錄下的配置腳本吟温。
- ~/.bash_logout - 用戶清理腳本序仙。當(dāng)?shù)卿浻脩敉顺鰰r(shí),執(zhí)行用戶目錄下的清理腳本鲁豪。
詳情參考man bash
潘悼。