> From: ogw@xxxxxxxxxxxxxxxxx (OGAWA Toshiya)
> Subject: [vine-users:050037] Re: mnews の設定について
> Date: Thu, 2 May 2002 12:37:04 +0900 (JST)
> Message-ID: 200205020337.MAA20934@xxxxxxxxxxxxxxxxxxxxxxxx
> > sh (bash) に読ませるなら、~/.bashrc あたりに書いておく必要があります。
>
> 単に書いただけでは、今使っているシェルには反映されません。
>
> (a) ログインし直す
> (b) $ bash として、もうひとつ重ねてシェルを起動してしまう
> (c) $ . ~/.bashrc として、明示的に今のシェルに読み込ませる。
>
> のどれかをしてやる必要があります。
たびたび、書いているのですが、bashrc と bash_profile の違いに
ついて、manpage で確認されることをおすすめします。
ログイン時に実行されるのは .bash_profile です。
対話 shell の起動時に実行されるのは .bashrc です。
ただし、多くの実装では(そうしないと不便なので).bash_profile
は、.bashrc も読み込むようにはなっています。
つまり、
ログイン時には、.bash_profile だけが実行されます。この時同
時に .bashrc も実行されるかどうかは .bash_profile の内容次第
です。
その後、対話 shell を起動すると、.bashrc が実行されますが、
.bash_profile は実行されません。
これを理解すると、.bash_profile と .bashrc の使い分けは自ずと
見えてきます。ごく簡単にいうと。
環境変数は、 .bash_profile に、エイリアスは .bashrc に
です。
Vine(RedHat) が初期値として用意してくれるこれらのファイルには
どういう目的で使うべきか、簡単なコメントが書かれています。
/etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
/etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
~/.bash_profile
# User specific environment and startup programs
~/.bashrc
# User specific aliases and functions
--
; kazz@xxxxxxxxxxxxxx