remove duplicate paths from $PATH in BASH

Here is one that I came up with:
PATH=`awk -F: ‘{for(i=1;i<=NF;i++){if(!($i in a)){a[$i];printf s$i;s=":"}}}'<<<$PATH`

One thought on “remove duplicate paths from $PATH in BASH”

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *