The goal here is to remove duplicate entries from the PATH variable.
But before I begin, let’s be clear: there’s no compelling reason to
to do this. The shell will, in essence, ignore duplicates PATH entries;
only the first occurrence of any one path is important.
Two motivations drive this exercise.
The first is to look at an awk one-liner that initially
doesn’t really appear to do much at all.
The second is to feed the needs of those who are annoyed by
such things as having duplicate PATH entries.
Source: Linux Journal