Sorry, the previous patch was wrong, it enters an endless loop when
replacing all the occurrencies in ${var//pat/rep}

Attached the correct one (I think).

Tests:
$ ./bash -c 'var=; echo "${var/#/x}"'
x
$ ./bash -c 'var=; echo "${var/*/x}"'
x
$ ./bash -c 'var=; echo "${var//*/x}"'
x
$ ./bash -c 'var=abc; echo "${var/#/x}"'
xabc
$ ./bash -c 'var=abc; echo "${var/*/x}"'
x
$ ./bash -c 'var=abc; echo "${var//*/x}"'
x

This behaviour is consistent with ksh.

Sorry for the trouble...


---
xoxo iza

Attachment: corrected-0001-replace-patterns-in-empty-strings.patch
Description: Binary data

Reply via email to