On 5/6/15 11:16 PM, isabella parakiss wrote:
> Sorry, the previous patch was wrong, it enters an endless loop when
> replacing all the occurrencies in ${var//pat/rep}
Thanks for the patch, this looks right. I had to make a couple of changes
to match_pattern_{char,wchar}, since your change allows
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 'va
I think this is wrong: var= ; echo "${var/*/x}"
It should print x but it prints nothing.
The attached patch fixes this, I hope it's ok.
I don't know what's the correct behaviour in case $var is unset, but it's
probably worth to look at, since bash prints nothing in that case too.
---
xoxo iza