tags:

views:

106

answers:

1

Similar question to How to keep from duplicating path variable in csh. But I don't use csh.

PATH=${SOMETHING}:${PATH}

How do I remove duplicates from PATH.

+1  A: 

I use this oneliner, but it depends on gawk.

PATH=$(echo $PATH|tr ":" "\n"|gawk '!($0 in a) { a[$0];print}'|paste -sd: - )
Sanjaya R
fwiw, the above works fine on OpenBSD with good old 'awk' instead of 'gawk'
dwc

related questions