Yeo*_*nho 3 osx shell bash path
我使用的是 OSX Mountain Lion 10.8.2
$echo $PATH
打印这个:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myusername/.rvm/bin
Run Code Online (Sandbox Code Playgroud)
我注释掉一切~/.bash_profile
,并~/.bashrc
并重新启动计算机,但在最后一部分$PATH
变量(/Users/myusername/.rvm/bin
)不会消失。
如何找出最后一部分添加到我的$PATH
变量的位置?
man bash
的INVOCATION
部分解释了启动交互式登录 shell 会话涉及哪些文件:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
其中任何一个都可以包含此赋值或source
/.
语句以获取包含此赋值的另一个脚本。由于您已经检查了最后两个,请尝试查看前两个以及这些来源中的任何文件。这通常包括/etc/profile.d/*
,它通常包含特定于应用程序的PATH
分配。
在我的特定情况下(Ubuntu 12.10)这四个文件来源如下:
/etc/profile
:
/etc/bash.bashrc
/etc/profile.d/*.sh
~/.bash_profile
不存在~/.bash_login
不存在~/.profile
:
$HOME/.bashrc
RVM 特别 要求您~/.bash_profile
为单用户安装提供其 RC 文件,因此这可能是一个不错的选择。