くんすとの備忘録

IT系技術メモ

移転しました。

15秒後に自動的にリダイレクトします。

Git Bashを立ち上げた時に.bashrcが読み込まれないっぽい

っぽい。

検証

設定ファイル

~/.bashrc
echo This is .bashrc
~/.bash_profile
echo This is .bash_profile

ログイン時の挙動

This is .bash_profile

kunst@DESKTOP-T3CMM04 MINGW64 ~
$

→ .bash_profile しか読み込まれてない

追加でbashを起動した時の挙動

$ bash
This is .bashrc

→ OK

対策

.bash_profileから.bashrcを読み込む

~/.bash_profile
echo This is .bash_profile

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

ログイン時の挙動

This is .bash_profile
This is .bashrc

kunst@DESKTOP-T3CMM04 MINGW64 ~
$

→ OK

追加でbashを起動した時の挙動

$ bash
This is .bashrc

→ OK