NetBSD-Bugs archive

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

Re: bin/50960: /bin/sh generates incorrect value for && and || inside $(( ))



> On Mar 12, 2016, at 3:55 PM, <kre%munnari.OZ.AU@localhost> <kre%munnari.OZ.AU@localhost> wrote:
> 
>> ...
> 	The logical && and || operators are supposed to generate a boolean
> 	value (which should be 0 for false and 1 for true, the same as
> 	is done in C).  Currently they generate 0 for false, ad non-zero
> 	for true (where the non-zero will be whichever of the operand
> 	values was decisive in determining the answer is not false, ie:
> 	the RHS for &&, or the LHS for ||).

Actually, 0 for true and non-zero for false, a very confusion shell rule.  But yes, other shells don't do this.  Then again, it's analogous to what Python does, for what little that's worth.

	paul



Home | Main Index | Thread Index | Old Index