Prevent duplicate entries in $PATH
This commit is contained in:
parent
61d4c9ca22
commit
c47bf603ed
@ -1,7 +1,14 @@
|
|||||||
# path, the 0 in the filename causes this to load first
|
# path, the 0 in the filename causes this to load first
|
||||||
path=(
|
#
|
||||||
$path
|
# If you have duplicate entries on your PATH, run this command to fix it:
|
||||||
$HOME/.yadr/bin
|
# PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}')
|
||||||
$HOME/.yadr/bin/yadr
|
|
||||||
)
|
|
||||||
|
|
||||||
|
pathAppend() {
|
||||||
|
# Only adds to the path if it's not already there
|
||||||
|
if ! echo $PATH | egrep -q "(^|:)$1($|:)" ; then
|
||||||
|
PATH=$PATH:$1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pathAppend "$HOME/.yadr/bin"
|
||||||
|
pathAppend "$HOME/.yadr/bin/yadr"
|
||||||
|
Loading…
Reference in New Issue
Block a user