Re: [PATCH] replace patterns in empty strings

2015-05-10 Thread Chet Ramey
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

Re: [PATCH] replace patterns in empty strings

2015-05-06 Thread isabella parakiss
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

[PATCH] replace patterns in empty strings

2015-05-06 Thread isabella parakiss
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