]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
refactor(base): remove `str_replace` from `dracut-lib.sh`
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Sun, 13 Mar 2022 17:04:10 +0000 (17:04 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 29 Sep 2022 05:23:07 +0000 (05:23 +0000)
Remove duplicate implementation of `str_replace` to follow-up
commit 148e420be5b5809aa8d5033f47477573bbbf3e60

modules.d/99base/dracut-lib.sh

index 44dd0178a2a7a22cb9e816aa27589d9d5b5991d9..2529af666ecfcdc4cc2fd0b208e95ababc339aac 100755 (executable)
@@ -103,26 +103,6 @@ vinfo() {
     done
 }
 
-# replaces all occurrences of 'search' in 'str' with 'replacement'
-#
-# str_replace str search replacement
-#
-# example:
-# str_replace '  one two  three  ' ' ' '_'
-str_replace() {
-    local in="$1"
-    local s="$2"
-    local r="$3"
-    local out=''
-
-    while strstr "${in}" "$s"; do
-        chop="${in%%"$s"*}"
-        out="${out}${chop}$r"
-        in="${in#*"$s"}"
-    done
-    echo "${out}${in}"
-}
-
 killall_proc_mountpoint() {
     local _pid
     local _killed=0