Merge branch '295-lisbstd-bash-in-function-std-replace_path-use-empty-string-as-default-for-replacestr' into 'master'

Resolve "lisbstd.bash: in function std::replace_path use empty string as default for 'replacestr'"

Closes #295

See merge request Pmodules/src!273
This commit is contained in:
2024-07-16 10:10:04 +02:00
+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}:" |