[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEL character treated specially when preceded by a backslash when us

From: Chet Ramey
Subject: Re: DEL character treated specially when preceded by a backslash when used in the RHS of the regex operator ([[ $'\177' =~ $'\\\177' ]])
Date: Sat, 18 Jan 2014 21:12:41 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 1/17/14, 2:30 PM, Eduardo A. Bustamante López wrote:

> So, in short, there are three issues here:
> 1) Why is $'\177' handled differently (just that non-graphic
> character, in comparison to the other non-graphic)?

I covered this earlier.

> 2) What's the reason of the incompatible behavior between bash in
> ubuntu vs bash in cygwin (i.e. the [[ keyword returning 2 for
> characters outside the ASCII range when trying to match them with =~)

Because the regexp engine refuses to compile it (regcomp() returns non-
zero).  Bash doesn't use its own regexp engine.

> 3) How should bash treat the case of a character preceded by a
> backslash in regular expressions (and globs, as Dan reported in a
> previous issue)?

I am getting to the point where I think that if a backslash makes it
through word expansion it should be quoted for the regexp engine.  Other
shells seem to agree on this point, though others are less clear.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]