From c5b80bd570a5f86af05a90d1241e8b4ede993a8f Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 23 Aug 2012 03:34:16 +0300 Subject: [PATCH 1/2] fix resetting fix resetting in case when removed path was moved to the end of PATH --- etc/profile.d/chruby.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/profile.d/chruby.sh b/etc/profile.d/chruby.sh index d81684fa..eb7053ac 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:||" <<< $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:||" <<< $PATH:` unset GEM_ROOT GEM_HOME GEM_PATH fi From 6b75c632ed109a92aa3262e2ec70ddc018753f56 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 23 Aug 2012 06:41:54 +0300 Subject: [PATCH 2/2] remove duplicate : --- etc/profile.d/chruby.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/profile.d/chruby.sh b/etc/profile.d/chruby.sh index eb7053ac..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