Oneliner bash built-in (doesn't work for repetition):

`PATH=${PATH/${PATH/#$DIR:*/$DIR:}/}${PATH/${PATH/*:$DIR*/:$DIR}/}`