From f0261262a8596241cb7ae784ab0a340ca311c5f7 Mon Sep 17 00:00:00 2001 From: David Runge Date: Thu, 10 Apr 2014 11:22:47 +0200 Subject: Fixing the way home/bin gets added to path, to work in any case --- .zsh.before/path.zsh | 18 ++++++++++++++---- 1 file 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 -- cgit v1.2.3-70-g09d2