.bash_profile が無い

メモ:  Category:ubuntu

~/.bash_profile の代わりは ~/.profile

Ubuntu のどのバージョンからかわかりませんが、 ~/.bash_profile がありません。

そのかわりに、 ~/.profile を使うようです。

~/.profile の中を確認すると、次のようにコメントが書かれています。

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.

~/.bash_profile を作成してしまうと、 ~/.profile を読みにいかなくなるようですので注意が必要です。

.bashrc と .bash_profile ( .profile ) の使ひ分け

~/.bash_profile はログイン時にのみ実行されます。

主な用途は次のようになります。

  • 環境変数を設定する (export する変数)

~/.bashrc は対話モードの bash を起動する時に毎回実行されます。 bash を起動する度に毎回設定する必要があるものになります。

主な用途は次のようになります。

  • 環境変数でない変数を設定する (export しない変数)
  • シェル関数を定義する
  • エイリアスを定義する
  • コマンドライン補完設定をする

bluenote by BBB