pre_path()ing directories with spaces is broken due to bad quoting.
This diff takes care of that by properly passing double quotes through
eval and quoting the arguments for no_path() individually.
Feedback?
diff --git a/etc/ksh.kshrc b/etc/ksh.kshrc
index 5b5bd040f79..66736da5e11 100644
--- a/etc/ksh.kshrc
+++ b/etc/ksh.kshrc
@@ -131,14 +131,14 @@ function no_path {
}
# if $1 exists and is not in path, append it
function add_path {
- [[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1"
+ [[ -d "${1:-.}" ]] && no_path "$@" && eval
${2:-PATH}=\"\$${2:-PATH}:$1\"
}
# if $1 exists and is not in path, prepend it
function pre_path {
- [[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}"
+ [[ -d "${1:-.}" ]] && no_path "$@" && eval
${2:-PATH}=\"$1:\$${2:-PATH}\"
}
# if $1 is in path, remove it
function del_path {
- no_path $* || eval ${2:-PATH}=$(eval echo :'$'${2:-PATH}: |
- sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;")
+ no_path "$1" || eval ${2:-PATH}=\"$(eval echo :'$'${2:-PATH}: |
+ sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;")\"
}