[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: |
Greg Wooledge |
Subject: |
Re: [PATCH 1/1] execute_cmd.c: don't treat rhs of = as pattern in conditional expressions |
Date: |
Fri, 24 Aug 2012 10:17:48 -0400 |
User-agent: |
Mutt/1.4.2.3i |
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:
When the == and != operators are used, the string to the right of
the operator is considered a pattern and matched according to the
rules described below under Pattern Matching. If the shell
option nocasematch is enabled, the match is performed without
regard to the case of alphabetic characters. The return value is
0 if the string matches (==) or does not match (!=) the pattern,
and 1 otherwise. Any part of the pattern may be quoted to force
it to be matched as a string.
Maybe this should be considered a documentation bug instead.
Re: [PATCH] rhs argument of single = in [[ <expression> ]] is also treated as pattern, Chet Ramey, 2012/08/24