记下$PATH变量中冗余路径所处顺序,例如:

/Users/zhang/.rvm/gems/ruby-2.1.2/bin:/Users/zhang/.rvm/gems/ruby-2.1.2@global/bin:/Users/zhang/.rvm/rubies/ruby-2.1.2/bin:/usr/local/bin:/usr/local/bin:

要删除第三处的冗余路径:

export PATH=`echo $PATH | cut -d":" -f1,2,4-`

`cut`参数用法可参照:cut

你也可以把这条命令加在~/.bash_profile后进行

source ~/.bash_profile



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2021-12-05
  • 2022-01-09
  • 2021-06-20
  • 2022-01-03
  • 2022-02-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2022-01-16
  • 2022-02-02
  • 2021-09-06
相关资源
相似解决方案