From: Michal Soltys Date: Thu, 15 Sep 2011 06:45:57 +0000 (+0200) Subject: str_replace() fix X-Git-Tag: 014~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb288154050ff5293bc9a0a72953cd2b93782abb;p=thirdparty%2Fdracut.git str_replace() fix 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 --- diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 50b1ed247..62c3bf54a 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -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}"