libstd.bash: in std::replace_path(): use empty string as default forreplacestr

This commit is contained in:
2024-07-16 09:58:56 +02:00
parent 288ba4cc6f
commit cda8298144
+1 -1
View File
@@ -152,7 +152,7 @@ std::remove_path() {
std::replace_path () {
local -r path="$1"
local -r removepat="$2"
local -r replacestr="$3"
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}:" |