Run $PATH dedup command everytime

This commit is contained in:
Luiz Gonzaga dos Santos Filho
2017-06-06 17:58:04 +02:00
committed by GitHub
parent 20b32fd07a
commit 28e4f07eb9

View File

@@ -1,7 +1,4 @@
# path, the 0 in the filename causes this to load first # path, the 0 in the filename causes this to load first
#
# If you have duplicate entries on your PATH, run this command to fix it:
# PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}')
pathAppend() { pathAppend() {
# Only adds to the path if it's not already there # Only adds to the path if it's not already there
@@ -10,5 +7,8 @@ pathAppend() {
fi fi
} }
# Remove duplicate entries from PATH:
PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}')
pathAppend "$HOME/.yadr/bin" pathAppend "$HOME/.yadr/bin"
pathAppend "$HOME/.yadr/bin/yadr" pathAppend "$HOME/.yadr/bin/yadr"