Created
September 17, 2019 11:22
-
-
Save ammarnajjar/a7ab65b7df0a21fc6c2b161ce87dcc5c to your computer and use it in GitHub Desktop.
remove duplicates from PATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove duplicates from PATH | |
# order in reverse as well | |
export PATH=$(echo -n $PATH | awk -v RS=: '{print}' | sort -r | awk '!($0 in a) {a[$0]; printf("%s%s", length(a) > 1 ? ":" : "", $0)}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment