[Top][All Lists]

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

Re: [[ ... =~ ... ]] is broken when RHS is quoted

From: Dave B
Subject: Re: [[ ... =~ ... ]] is broken when RHS is quoted
Date: Sun, 22 Jun 2008 19:20:26 +0200
User-agent: Thunderbird (X11/20080529)

Alexis Huxley wrote:

> "Quote removal" means that, as usual, quotes do not form part of the
> arguments, they merely serve to delimit the arguments, I take it.
> "Words between [[ and ]] ... quote removal performed" means on *all*
> words between [[ and ]] I take it. Hmm ...  No, that can't be right
> otherwise
>       bash -c '[[ "apple" =~ "(apple)" ]]; echo ${BASH_REMATCH[1]}'
> would say apple. Hmmm ... while the CHANGES file indicates that I
> was wrong that bash is broken, I would say that bash is broken
> *w.r.t. the behaviour documented in its man page*. What do you think?

But bash *does* do quote removal, if you supply quoted arguments. If you do

bash -c '[[ "apple" =~ "(apple)" ]]; echo ${BASH_REMATCH[1]}'

then bash does quote removal and sees

apple =~ (apple)

Then, since the RHS was quoted, it performs string matching instead of re
matching. But before that it did do quote removal nonetheless.


reply via email to

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