PATH变量重复

命令:

export PATH=$(echo $PATH | tr : "\n"| sort | uniq | tr "\n" :)

Code:

awk -F: '{
sep = ""
for (i = 1; i <= NF; ++i)
    if (unique[$i] != 1)
    {
        ut = out sep $i
        sep = ":"
        unique[$i] = 1
    }
print out
}' < < < $PATH
posted @ 2017-09-04 17:15  bamboo233  阅读(321)  评论(0)    收藏  举报