From 7d806a8a6b4e2e2c0fefa4c10fa18cc9ababd14b Mon Sep 17 00:00:00 2001 From: hophacker Date: Wed, 10 Apr 2019 18:40:13 +0800 Subject: [PATCH] Run $PATH dedup command everytime --- zsh/0_path.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/0_path.zsh b/zsh/0_path.zsh index 04ed6c3..050e67a 100644 --- a/zsh/0_path.zsh +++ b/zsh/0_path.zsh @@ -1,7 +1,4 @@ # 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() { # Only adds to the path if it's not already there @@ -10,5 +7,8 @@ pathAppend() { 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/yadr"