mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-29 02:39:39 +02:00
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:
@@ -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}:" |
|
||||
|
||||
Reference in New Issue
Block a user