Nervesのインストール手順を見ていて気づいた点。
Nervesの1.5.0がリリースされて、「Erlang 22」「Elixir 1.9.0-otp-22」対応となった。
そのため、Nervesのインストール手順では、asdf経由でインストールするErlang とElixirのバージョンは、それぞれ22と1.9.0変更されている。(※「nerves_bootstrap」の1.6.0が、Elixirの1.9を要求するため。)
しかし、それ以外にも、asdfの設定先が「.bash_profile」から「.bashrc」に変更されていた。
Nervesの1.5.0では、以下の記述になっている。
# The following steps are for bash. If you’re using something else, do the # equivalent for your shell. echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc # optional source ~/.bashrc
https://hexdocs.pm/nerves/1.5.0/installation.html#all-platforms
一方、一つ前のバージョン(1.4.5)では、以下であった。
# The following steps are for bash. If you’re using something else, do the # equivalent for your shell. echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile # optional source ~/.bash_profile
https://hexdocs.pm/nerves/1.4.5/installation.html#all-platforms
両者の違いは、「~/.bash_profile」がログイン時にのみ実行されるのに対して、「~/.bashrc」はbashの対話モード起動の場合に毎回起動されるものである。
両者の詳しい説明は、こちらの記事が参考になる。
techracho.bpsinc.jp
なお、変更された経緯は分からないが、こちらの記事を見る限り、Ubuntuの場合.bash_profileが無視されることが関係していそう。
そうでなかったとしても、前述の「~/.bash_profile」と「~/.bashrc」の違いに関する記事を読む限りは、「~/.bashrc」に書くのは妥当のように思えた。