Re: [PATCH 1/1] execute_cmd.c: don't treat rhs of = as pattern in condit
From:
Chet Ramey
Subject:
Re: [PATCH 1/1] execute_cmd.c: don't treat rhs of = as pattern in conditional expressions
Date:
Fri, 24 Aug 2012 11:54:30 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0
On 8/24/12 11:03 AM, Michal Soltys wrote:
>>> 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 ?
Yep, that's reasonable. Thanks for bringing it to light.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/