[Top][All Lists]

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

Re: Quoting near =~ is inconsistent

From: Tim Waugh
Subject: Re: Quoting near =~ is inconsistent
Date: Thu, 18 Jan 2007 15:10:29 +0000

Further to this, I am having trouble porting existing scripts to
bash-3.2's new style of regex matching.

Here is one example that is problematic: I want to use a character class
in my regex, but bash seems to get confused by the ':]]' closing the
class, and apparently takes it as a ']]' closing the conditional

Here is a distilled test case:

[[ $line =~ [[:space:]]*(a)?b ]] && echo match || echo no match

I used single quotes around the RHS in bash-3.1, which worked very well.
How should this be written so as to work with bash-3.2 -- and, of
course, still with bash-3.1?


Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

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