Bashの起動file、関数、aliasと環境1 / 3

Shellの起動条件

Bashはlogin shellか、interactiveかなどの条件で読むfileが変わる。interactive login shellは/etc/profileの後、利用者の~/.bash_profile、/.bash_login、/.profileの順で最初に存在し読めるものを使う。三つを常に全部読むのではない。login shell終了時には~/.bash_logoutが使われる。

interactiveなnon-login shellは通常~/.bashrcを読む。/etc/bash.bashrcなどsystem全体の追加設定の扱いはdistributionの構成による。login用のprofileから.bashrcを明示的に読む構成もある。毎回どのshellを起動したか、どのfileから別のfileをsourceしているかを調べる。

学習パスへ
参考資料