centos下如何清除重复的$PATH变量值
2018-06-11 13:45 鸣仁 阅读(1090) 评论(0) 编辑 收藏 举报运行:
vim /etc/profile
添加如下代码:
awk -F: '{
sep = ""
for (i = 1; i <= NF; ++i)
if (unique[$i] != 1)
{
out = out sep $i
sep = ":"
unique[$i] = 1
}
print out
}' <<< $PATH
运行:
source /etc/profile