str_replace() fix
authorMichal Soltys <soltys@ziu.info>
Thu, 15 Sep 2011 06:45:57 +0000 (08:45 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 22 Sep 2011 13:46:11 +0000 (15:46 +0200)
Whitespace removal in:

out="${out}${chop# }$r"

will damage certain strings, for example the following call:

str_replace ' aax aaxaa' x y

would return 'aayaayaa' instead of ' aay aayaa'.

Signed-off-by: Michal Soltys <soltys@ziu.info>
modules.d/99base/dracut-lib.sh

index 50b1ed2..62c3bf5 100755 (executable)
@@ -24,7 +24,7 @@ str_replace() {
 
     while strstr "${in}" "$s"; do
         chop="${in%%$s*}"
-        out="${out}${chop}$r"
+        out="${out}${chop}$r"
         in="${in#*$s}"
     done
     echo "${out}${in}"