gpt4 book ai didi

linux - 如何在 Cygwin 中重置 PATH 变量列表

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:32:39 28 4
gpt4 key购买 nike

$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/PC Connectivity Solution:/cygdrive/c/Program Files (x86)/RSA SecurID Token Common:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/IBM/Client Access/Emulator:/cygdrive/c/Program Files (x86)/IBM/Client Access/Shared:/cygdrive/c/Program Files (x86)/IBM/Client Access:/cygdrive/c/Program Files (x86)/Enterprise Vault/EVClient:/cygdrive/c/Program Files/Java/jdk1.7.0/bin:/cygdrive/c/apache-maven-3.1.1/bin:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/Program Files (x86)/QuickTime/QTSystem:/cygdrive/c/apache-tomcat-7.0.52/bin:/usr/bin:%HADOOP_HOME%/bin

想要删除一些不需要的值并将上面的整个字符串重置为以下

/usr/local/bin:/usr/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Java/jdk1.7.0/bin:/cygdrive/c/apache-maven-3.1.1/bin:/cygdrive/c/Program Files/TortoiseSVN/bin

我该怎么做?请指导。

最佳答案

所有 cygdrive 路径都是由 cygwin 从您的 Windows 路径自动添加的。

sed 命令将在 .bashrc 的末尾附加一行以设置您的 PATH:

sed -i '$a\PATH="/usr/local/bin:/usr/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Java/jdk1.7.0/bin:/cygdrive/c/apache-maven-3.1.1/bin:/cygdrive/c/Program Files/TortoiseSVN/bin"' .bashrc

关于linux - 如何在 Cygwin 中重置 PATH 变量列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24337847/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com