Browse Source

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 <soltys@ziu.info>
master
Michal Soltys 14 years ago committed by Harald Hoyer
parent
commit
cb28815405
  1. 2
      modules.d/99base/dracut-lib.sh

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

@ -24,7 +24,7 @@ str_replace() { @@ -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}"

Loading…
Cancel
Save