我找到了罪魁祸首.秘密酱是/usr/libexec/path_helper它在文件/etc/paths和目录中查找/etc/paths.d/.
第一个执行以下代码的bash源/etc/profile:
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
# The above line is the secret sauce, so to say...
# First is adds default PATH values from the file /etc/paths
# Then all files in the /etc/paths.d/ directory are read and directories listed
# in each file (one per line) are appended to PATH
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
Run Code Online (Sandbox Code Playgroud)
接下来bash验看~/.bash_profile,~/.bash_login和~/.profile.
列出这些步骤,PATH构建如下:
/etc/paths被添加到PATH/etc/paths.d/被追加到PATH-请注意,这些附加与被预先考虑.PATH={DIR_2_ADD}:"${PATH}"我~/.bash_profile和~/.bashrc文件中的各种语句都是前置的PATH| 归档时间: |
|
| 查看次数: |
1115 次 |
| 最近记录: |