argius note

プログラミング関連

.bash_profileとsourceコマンド

忘れてたので復習。
最初のログイン時に、/etc/skel以下のファイル(.bashrc, .inputrc, .bash_profile)がhomeディレクトリにコピーされる。で、.bash_profileには、

(抜粋)
# source the users bashrc if it exists
if [ -e "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi

と書いてある。つまり、homeディレクトリ直下に.bashrcがあれば、それを実行する。sourceコマンドは、現在のシェル上*1でファイルに書かれた内容を実現する。

*1:「新しくプロセスを作らないで実行」で合ってるかな?