[ "(" = foo ] && echo foo sh: closing paren expected
Here is the specification: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html The text explaining why bb ash's behavior is wrong: "3 arguments: - If $2 is a binary primary, perform the binary test of $1 and $3. - If $1 is '!', negate the two-argument test of $2 and $3. - [OB XSI] [Option Start] If $1 is '(' and $3 is ')', perform the unary test of $2. [Option End] On systems that do not support the XSI option, the results are unspecified if $1 is '(' and $3 is ')'. - Otherwise, produce unspecified results." In the case of this bug, $2 is the binary primary =. Thus the first rule takes precedence. BB ash is wrongly giving the third rule for the obsolescent parens precedence.
Can't reproduce. I think I remember how this was fixed sometime ago. Try most recent released version.