ふとシェルの環境変数の読み込みファイルはどんな順番だったか思い出したくなった。
man bash より引用
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
- /etc/profile
- ~/.bash_profile
- .bash_login
- .profile
の順でさがし、最初に見つかったもの1つを読み込むと。
interactive だけど login shell でない場合は、
man bash より引用When an interactive shell that is not a login shell is started, bash~/.bashrc のみ読みこむ
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
/etc/profileを覗いてみると
となっている。この /usr/libexec/path_helper -s を実行してみると# System-wide .profile for sh(1)if [ -x /usr/libexec/path_helper ]; then
if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s`
eval `/usr/libexec/path_helper -s` fi
fiif [ "${BASH-no}" != "no" ]; then
if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc
[ -r /etc/bashrc ] && . /etc/bashrc fi
fi
PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"; export PATHman path_helper すると、-s は Bourne shell 用で、 -c が C-shell 用の出力をするとあり、参照先はそれぞれ
MANPATH="/usr/share/man:/usr/local/share/man:/usr/X11/man"; export MANPATH
- PATH: /etc/paths, /etc/paths.d/以下のファイル
- MANPATH: /etc/manpaths, /etc/manpaths.d/以下のファイル
0 件のコメント:
コメントを投稿