用bash清理$PATH

前端之家收集整理的这篇文章主要介绍了用bash清理$PATH前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的路径有很多很久以前由脚本添加的条目.它们不在我的.bashrc,.bash_profile或.bash_login中.

我担心在.bashrc中重置我的路径会产生不良的长期结果.有没有办法找到添加到我的路径的地方并手动删除它们?事物是总是按文件添加还是路径缓存在某个地方?如果是后者,是否容易清理?

找到修改PATH的最简单方法是运行:
  1. $bash --login -i -xv 2>&1 | grep ' \. '

比如我得到了:

  1. + . /etc/profile.d/bash_completion.sh
  2. . /etc/bash_completion
  3. ++ . /etc/bash_completion
  4. +++ . /etc/bash_completion.d/abook
  5. +++ . /etc/bash_completion.d/ant
  6. + . /etc/profile.d/lapack0.sh
  7. + . /etc/profile.d/openssl.sh
  8. + . /etc/profile.d/qt3-devel.sh
  9. + . /etc/profile.d/tetex-profile.sh
  10. + . /etc/profile.d/xinit.sh
  11. + . /etc/bash.bashrc

猜你在找的Bash相关文章