bug-bash
[Top][All Lists]
Advanced

[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: Greg Wooledge
Subject: Re: DEL character treated specially when preceded by a backslash when used in the RHS of the regex operator ([[ $'\177' =~ $'\\\177' ]])
Date: Fri, 17 Jan 2014 08:01:30 -0500
User-agent: Mutt/1.4.2.3i

On Thu, Jan 16, 2014 at 03:46:38PM -0800, Eduardo A. Bustamante López wrote:
> [[ $'\a' =~ $'\a' ]] -> 0
> [[ $'\a' =~ $'\\\a' ]] -> 0
> [[ $'\a' =~ $'\\[\a]' ]] -> 1
> ---
> [[ $'\177' =~ $'\177' ]] -> 0
> [[ $'\177' =~ $'\\\177' ]] -> 1
> [[ $'\177' =~ $'\\[\177]' ]] -> 1

> Notice that only $'\177' seems to fail in the middle case, while the
> others work just fine.

Maybe I'm missing something, but why do you consider that to be wrong?
I would expect [[ x =~ yx ]] to fail (return 1) every time.  In fact
I'd consider this result:

> [[ $'\a' =~ $'\\\a' ]] -> 0

to be wrong.  And in fact, on my version of bash I get a different result:

imadev:~$ [[ $'\a' =~ $'\\\a' ]] ; echo $?
1
imadev:~$ echo $BASH_VERSION
4.3.0(1)-beta2

I get a return value of 1 in every version of bash I tried except
bash 3.1, which returns 0, and bash 2.05b, which gives a syntax
error because it doesn't have =~ yet.



reply via email to

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