From b83f876289bd343e4cf36d4972b9b87cf4c0bed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Achim=20Gsell=C3=BC?= Date: Fri, 14 Sep 2018 16:52:36 +0200 Subject: [PATCH] Pmodules/bash: - std::append_path() and std::replace_path(): bugfix: spaces in directory names were not handled correctly --- Pmodules/bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Pmodules/bash b/Pmodules/bash index 4c4bb0c..976cd75 100644 --- a/Pmodules/bash +++ b/Pmodules/bash @@ -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() {