mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-28 02:19:39 +02:00
Pmodules/bash:
- std::append_path() and std::replace_path(): bugfix: spaces in directory names were not handled correctly
This commit is contained in:
+4
-4
@@ -65,9 +65,9 @@ std::append_path () {
|
||||
|
||||
if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then
|
||||
if [[ -z ${!P} ]]; then
|
||||
eval $P="${d}"
|
||||
eval $P=\"${d}\"
|
||||
else
|
||||
eval $P="${!P}:${d}"
|
||||
eval $P=\"${!P}:${d}\"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -95,8 +95,8 @@ std::replace_path () {
|
||||
local -r replacestr="$3"
|
||||
|
||||
local -r removestr=$(echo "${!path}" | tr ":" "\n" | grep -m 1 "^$removepat\$")
|
||||
export $path=$(echo "${!path}" | tr ":" "\n" | sed "s:^${removestr}\$:${replacestr}:" |
|
||||
sed '/^\s*$/d' | tr "\n" ":" | sed -e 's|^:||' -e 's|:$||')
|
||||
export $path="$(echo "${!path}" | tr ":" "\n" | sed "s:^${removestr}\$:${replacestr}:" |
|
||||
sed '/^\s*$/d' | tr "\n" ":" | sed -e 's|^:||' -e 's|:$||')"
|
||||
}
|
||||
|
||||
save_env() {
|
||||
|
||||
Reference in New Issue
Block a user