diff options
author | David Runge <david.runge@frqrec.com> | 2014-04-10 11:22:47 +0200 |
---|---|---|
committer | David Runge <david.runge@frqrec.com> | 2014-04-10 11:22:47 +0200 |
commit | f0261262a8596241cb7ae784ab0a340ca311c5f7 (patch) | |
tree | 1b43230e1ef08ba802a8f8eadcd3d02aafd4d2c0 | |
parent | 123cac54302da6a4db37cd28df79ec35d322f9ea (diff) | |
download | dotfiles-f0261262a8596241cb7ae784ab0a340ca311c5f7.tar.gz dotfiles-f0261262a8596241cb7ae784ab0a340ca311c5f7.tar.bz2 dotfiles-f0261262a8596241cb7ae784ab0a340ca311c5f7.tar.xz dotfiles-f0261262a8596241cb7ae784ab0a340ca311c5f7.zip |
Fixing the way home/bin gets added to path, to work in any case
-rw-r--r-- | .zsh.before/path.zsh | 18 |
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 |