Account for path entries with spaces in remove_from_path

This commit is contained in:
Sam Stephenson 2011-12-30 13:40:22 -06:00
parent 114b81c9a4
commit 5d0a6630b9

View file

@ -27,7 +27,10 @@ remove_from_path() {
return return
fi fi
for path in ${PATH//:/$'\n'}; do local paths
IFS=: paths=($PATH)
for path in "${paths[@]}"; do
path="$(expand_path "$path" || true)" path="$(expand_path "$path" || true)"
if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then
result="${result}${path}:" result="${result}${path}:"