From 5d0a6630b94f4a1e2aae8828788a76432f5ace09 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 30 Dec 2011 13:40:22 -0600 Subject: [PATCH] Account for path entries with spaces in remove_from_path --- libexec/rbenv-which | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libexec/rbenv-which b/libexec/rbenv-which index 768e845..c4966c7 100755 --- a/libexec/rbenv-which +++ b/libexec/rbenv-which @@ -27,7 +27,10 @@ remove_from_path() { return fi - for path in ${PATH//:/$'\n'}; do + local paths + IFS=: paths=($PATH) + + for path in "${paths[@]}"; do path="$(expand_path "$path" || true)" if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then result="${result}${path}:"