I have inherited some pretty gnarly dotfiles that I don't really want to fool with too much,
but I'm also unhappy with what they do to my environment.  They keep adding the
same things over and over to some of the variables.

Does anyone know a nice little idiom for de-duping a colon-list like PATH or MANPATH?
It has to retain one copy of each duplicate, preserving the order of *first* appearances.
I know how to avoid duplicates when I do the coding myself:
       case :$PATH: in
             *:mynewthing:*) ;;
             *) export PATH=$PATH:mynewthing
       esac

I'm just not sure how best to turn the colon-list into something I can iterate over.

Obviously, I use bash.

++ kevin

--
Kevin O'Gorman, PhD

Reply via email to