libstd.bash: fixes in append_path() and prepend_path()

- use export instead of eval
This commit is contained in:
2019-05-13 16:42:27 +02:00
parent 4fcc74839c
commit f446d4cae9
+6 -6
View File
@@ -67,14 +67,14 @@ std::get_abspath() {
}
std::append_path () {
local -r P="$1"
local -r d="$2"
local -r P=$1
local -r d=$2
if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then
if [[ -z ${!P} ]]; then
eval $P=\"${d}\"
export "$P=${d}"
else
eval $P=\"${!P}:${d}\"
export "$P=${!P}:${d}"
fi
fi
}
@@ -85,9 +85,9 @@ std::prepend_path () {
if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then
if [[ -z ${!P} ]]; then
eval $P=${d}
export "$P=${d}"
else
eval $P=${d}:${!P}
export "$P=${d}:${!P}"
fi
fi
}