Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在终端中设置一个 PATH 。我试过 ;
export PATH=/usr/local/sample
好像没问题。但在那之后我失去了我之前设置的另一条路径。问题是什么?
您应该像这样添加 PATH :
export PATH=/usr/local/sample/:$PATH
附加 $PATH 将添加在 PATH 中设置的当前值。
像这样做:export PATH=$PATH:/usr/local/sample
export PATH=$PATH:/usr/local/sample
您为 PATH 分配了一个新值 ( PATH = VALUE)。您想要的是向 PATH ( PATH = PATH + VALUE) 添加一个新值。
PATH = VALUE
PATH = PATH + VALUE