On 1/17/14 2:30 PM, Eduardo A. Bustamante López wrote: > On Fri, Jan 17, 2014 at 08:43:46AM -0500, Chet Ramey wrote: >> On 1/16/14 6:46 PM, Eduardo A. Bustamante López wrote: >>> The DEL ($'\177') character does not behave like the other control >>> characters when used with the regex operator inside the test keyword. >> >> This has to do with the expansion of $r and that $r includes a backslash. >> When combined with the internal quoting bash does, and the fact that the >> backslash is special to pattern matching, we end up with this problem. >> I've only thought about it a little so far, but I don't know if there's a >> quick or simple fix. This may have to wait until after bash-4.3 is >> released. >> >> Chet > I understand that the backslash preceding a character *could* make it > to not match, though $'\177' is the *only* non-graphic character that > has this behavior.
No, I understand the problem. The DEL is special to bash's internal expansion and quoting (this just came up in another message earlier this week). That, combined with the slightly inconsistent word expansion bash does for the operands in the [[ command and the fact that there is a backslash in the expansion, results in a problem that seemingly affects only DEL. There are other characters that aren't handled exactly right, including \001, but fortunate circumstances make those cases work. And it's not that the backslash gets passed to the regexp engine, but that its presence causes bash to do the wrong thing when there is a DEL in the string. It's not understanding the problem, or the combination of things that causes it, but figuring out the right solution. 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/