10000 Ensure that we can remove bin/ directories from the end of PATH. · devandroid/chruby@ec96541 · GitHub
[go: up one dir, main page]

Skip to content

Commit ec96541

Browse files
committed
Ensure that we can remove bin/ directories from the end of PATH.
* Sanitize the PATH by stripping leading/tailing ':'s.
1 parent 41c0bc3 commit ec96541

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

etc/profile.d/chruby.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ function chruby_reset()
44
{
55
[[ -z "$RUBY" ]] && return
66

7-
export PATH=`sed -e "s|$RUBY/bin:||g" <<< $PATH`
8-
unset RUBY RUBY_ENGINE RUBY_VERSION RUBYOPT
7+
export PATH=`sed -e "s|$RUBY/bin:||g" <<< :$PATH:`
98
109
if [[ -n "$GEM_HOME" ]] && [[ -n "$GEM_ROOT" ]]; then
1110
export PATH=`sed -e "s|$GEM_HOME/bin:||g; s|$GEM_ROOT/bin:||g" <<< $PATH`
12-
unset GEM_ROOT GEM_HOME GEM_PATH
1311
fi
1412
13+
unset RUBY RUBY_ENGINE RUBY_VERSION RUBYOPT GEM_ROOT GEM_HOME GEM_PATH
14+
15+
export PATH=`sed -e "s|^:*||; s|:*$||" <<< $PATH`
1516
hash -r
1617
}
1718

0 commit comments

Comments
 (0)
0