[Top][All Lists]

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

Re: [PATCH 1/1] execute_cmd.c: don't treat rhs of = as pattern in condit

From: Michal Soltys
Subject: Re: [PATCH 1/1] execute_cmd.c: don't treat rhs of = as pattern in conditional expressions
Date: Fri, 24 Aug 2012 17:03:40 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0

On 2012-08-24 16:34, Chet Ramey wrote:
On Fri, Aug 24, 2012 at 10:01:32AM -0400, Chet Ramey wrote:
> On 8/24/12 8:54 AM, Michal Soltys wrote:
> > In case of single '=' operator used in [[ <expression> ]], rhs argument
> > was treated as a pattern. Only == and != should treat rhs argument as a
> > pattern, so this patch fixes it.
> Incorrect; `=' and `==' are identical.

Perhaps he is assuming the man page is exhaustive.  The section for the
[[ command only mentions the == and != operators:

Maybe.  The `CONDITIONAL EXPRESSIONS' section makes it clear they're identical.

This section only mentions string comparisons - nothing related to pattern matching or regex is mentioned there. It would also imply that [ $a = $b ] and [[ $a = $b ]] are identical, and it's clearly not the case. The differences between [ and [[ are in earlier "Compound Commands" and "rhs argument is pattern" feature is only mentioned for == and !=.

Anyway, maybe some small patch against bash.1 then to avoid confusion ?

Namely: mention different interpretation of '=' in "Compound Commands" and - in 'CONDITIONAL EXPRESSIONS' - refer to that part for [ and [[ differences ?

reply via email to

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