清理在bash $ PATH [英] cleaning up $PATH in bash

查看:116
本文介绍了清理在bash $ PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的道路有很多添加不久前脚本条目。他们是不是在我的.bashrc,.bash_profile中,或.bash_login文件。

My path has a lot of entries that were added long ago by scripts. They are not in my .bashrc, .bash_profile, or .bash_login.

我担心,在.bashrc中重置我的道路将有不良的长期结果。有没有办法寻找到的东西已经被添加到我的道路,并手动删除它们?事情总是由文件添加或路径缓存的地方?如果是后者,是很容易清理一下?

I'm worried that resetting my path in .bashrc will have undesirable long-term results. Is there a way to find where things have been added to my path and remove them manually? Are things always added by file or is path cached somewhere? If the latter, is it easy to clean that up?

推荐答案

最简单的方式找到的修改您的 PATH 是运行:

The easiest way to find who modified your PATH is to run:


  $ bash --login -i -xv 2>&1 | grep ' \. '

例如我有:


+ . /etc/profile.d/bash_completion.sh
        . /etc/bash_completion
++ . /etc/bash_completion
+++ . /etc/bash_completion.d/abook
+++ . /etc/bash_completion.d/ant
+ . /etc/profile.d/lapack0.sh
+ . /etc/profile.d/openssl.sh
+ . /etc/profile.d/qt3-devel.sh
+ . /etc/profile.d/tetex-profile.sh
+ . /etc/profile.d/xinit.sh
+ . /etc/bash.bashrc

...

...

这篇关于清理在bash $ PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆