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

Re: Uxexpected complaint of "unbound variable"

2015-05-06 Thread James Caccese
Thank you very much, I appreciate the explanation -James From: Chet Ramey To: James Caccese ; "bug-bash@gnu.org" Cc: chet.ra...@case.edu Sent: Tuesday, May 5, 2015 8:55 AM Subject: Re: Uxexpected complaint of "unbound variable" On 5/4/15 9:03 PM, James Caccese wrote: > I posted th

[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