On 3/5/15 9:51 AM, Eduardo A. Bustamante López wrote:
> On Thu, Mar 05, 2015 at 02:26:48PM +0000, Jason Vas Dias wrote:
>> Good day list, Chet -
>>
>> I think this is a bug:
>> ( set -x ; tab=$'\011'; s="some text: 1.2.3";
>> if [[ "$s" =~ ^some text:[\ $tab]+([0-9.]+) ]]; then
>> echo "${BASH_REMATCH[1]}";
>> fi
>> )
>> -bash: syntax error in conditional expression
>> -bash: syntax error near `$tab]+([0-9.]+)'
>>
> From a quick glance, it does seem like a parsing bug, it should not break with
> a syntax error.
It's not a bug; the space between ^some and text needs to be escaped
somehow to prevent it breaking words.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/