Skip to content

Instantly share code, notes, and snippets.

@githiro
Last active April 27, 2018 05:50
Show Gist options
  • Save githiro/45f4bf746e2745f71e543eedebd5a6ca to your computer and use it in GitHub Desktop.
Save githiro/45f4bf746e2745f71e543eedebd5a6ca to your computer and use it in GitHub Desktop.
Bash: Bash profile
# PS1
export PS1="\t \W \\$ "
# Read "~/.bashrc". ".bashrc" is only read by a shell that's both interactive and non-login
test -r ~/.bashrc && . ~/.bashrc
@githiro
Copy link
Author

githiro commented Apr 27, 2018

bash_profile

.bash_profile はログイン時にのみ実行されます。具体的な用途は:

  • 環境変数を設定する (export する変数)
  • 環境変数はプロセス間で勝手に受け継がれるのでログイン時のみ設定すれば十分です。

.bashrc

.bashrc は対話モードの bash を起動する時に毎回実行されます。具体的な用途は:

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

これらは bash を起動する度に毎回設定する必要があるものです。

以下より引用: https://qiita.com/magicant/items/d3bb7ea1192e63fba850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment