aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zsh.before/path.zsh18
1 files changed, 14 insertions, 4 deletions
diff --git a/.zsh.before/path.zsh b/.zsh.before/path.zsh
index 843121b..0f8ea6f 100644
--- a/.zsh.before/path.zsh
+++ b/.zsh.before/path.zsh
@@ -15,10 +15,20 @@
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
-# replace /usr/local/bin once with $HOME/bin:/usr/local/bin in $PATH
-autoload -U regexp-replace
-if [[ "$PATH" != *dave/bin:/usr/local/sbin* && "$HOST" != *giev* ]];then
- regexp-replace PATH '/usr/local/sbin:/usr/local/bin:' '$HOME/bin:/usr/local/sbin:/usr/local/bin:'
+# Add $HOME/bin before /usr/local/sbin and /usr/local/bin in $PATH
+# Also works if they are switched
+if [[ "$HOST" != *giev* ]];then
+ autoload -U regexp-replace
+ if [[ "$PATH" != *dave/bin:/usr/local/sbin* ]];then
+ case "$PATH" in
+ */usr/local/bin:/usr/local/sbin*)
+ regexp-replace PATH '/usr/local/bin:/usr/local/sbin:' '$HOME/bin:/usr/local/sbin:/usr/local/bin:'
+ ;;
+ */usr/local/sbin:/usr/local/bin*)
+ regexp-replace PATH '/usr/local/sbin:/usr/local/bin:' '$HOME/bin:/usr/local/sbin:/usr/local/bin:'
+ ;;
+ esac
+ fi
fi
## RASPBERRY PI