On 2/15/11 6:18 AM, Clark J. Wang wrote:
> For following script:
> 
> var='[hello'
> echo "${var//[/}"
> 
> With bash 4.1 it outputs hello but with 4.2 it outputs [hello . And bash 4.2
> with compat41 on still outputs [hello . Bug? Or Bug fixed?

It's a bug, and I will release a patch.  In the meantime, see if the
attached patch does the right thing on your platform.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.2/lib/glob/gmisc.c	2011-02-05 16:11:17.000000000 -0500
--- lib/glob/gmisc.c	2011-02-15 20:50:43.000000000 -0500
***************
*** 126,129 ****
--- 126,130 ----
  		{
  	          matlen += wpat - wbrack - 1;	/* incremented below */
+ 	          wpat--;			/* back up to NUL */
  	          break;
  	        }
***************
*** 262,265 ****
--- 263,267 ----
  		{
  	          matlen += pat - brack - 1;	/* incremented below */
+ 	          pat--;			/* back up to NUL */
  	          break;
  	        }

Reply via email to