在Linux中添加环境变量PATH,方法之一是在/etc/profile中添加。
我先是这样写了:export PATH=/home/bin:$PATH
然后,使之生效:source /etc/profile
这时,查看:echo $PATH
发现,显示出来的只有:/home/bin,而如/usr/bin,/bin都没了。
解决方法是:在/etc/profile中应写成:export PATH=$PATH:/home/bin
而如果是临时的添加PATH路径,应在终端中输入:export PATH=/home/bin:$PATH
转载于:https://blog.51cto.com/liangbing8612/634759