diff --git a/etc/profile.d/chruby.sh b/etc/profile.d/chruby.sh index d81684fa..edc45c69 100644 --- a/etc/profile.d/chruby.sh +++ b/etc/profile.d/chruby.sh @@ -4,11 +4,11 @@ function chruby_reset() { [[ -z "$RUBY" ]] && return - export PATH=`sed -e "s|$RUBY/bin:||" <<< $PATH` + export PATH=`sed -e "s|:$RUBY/bin:||; s|^:||; s|:$||" <<< :$PATH:` unset RUBY RUBYOPT if [[ -n "$GEM_HOME" ]] && [[ -n "$GEM_ROOT" ]]; then - export PATH=`sed -e "s|$GEM_HOME/bin:||; s|$GEM_ROOT/bin:||" <<< $PATH` + export PATH=`sed -e "s|:$GEM_HOME/bin:|:|; s|:$GEM_ROOT/bin:|:|; s|^:||; s|:$||" <<< :$PATH:` unset GEM_ROOT GEM_HOME GEM_PATH fi