bug-bash
[Top][All Lists]
Advanced

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

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


From: Alexis Huxley
Subject: Re: [[ ... =~ ... ]] is broken when RHS is quoted
Date: Sun, 22 Jun 2008 19:15:50 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

> > Description:
> >        [[ ... =~ ... ]] is broken when RHS is quoted
> 
> from http://tiswww.case.edu/php/chet/bash/CHANGES :
> 
> f.  Quoting the string argument to the [[ command's  =~ operator now forces
>     string matching, as with the other pattern-matching operators.

Hmmm ... ok, thanks, I did miss that. While I think that that is
reasonably clear, I think the man page is not:

        Word splitting and pathname expansion are not performed on
        the words  between  the  [[  and     ]];  tilde expansion,
        parameter  and variable expansion, arithmetic expansion,
        command substitution, process substitution, and quote removal
        are performed.                                  ^^^^^^^^^^^^^

"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?

Alexis




reply via email to

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