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 $(( ))
The following reply was made to PR bin/50960; it has been noted by GNATS.
From: <Paul_Koning%Dell.com@localhost>
To: <gnats-bugs%NetBSD.org@localhost>
Cc: <gnats-admin%netbsd.org@localhost>, <netbsd-bugs%netbsd.org@localhost>
Subject: Re: bin/50960: /bin/sh generates incorrect value for && and ||
inside $(( ))
Date: Sat, 12 Mar 2016 21:34:59 +0000
> On Mar 12, 2016, at 3:55 PM, <kre%munnari.OZ.AU@localhost> <kre%munnari.OZ.AU@localhost> wrot=
e:
>=20
>> ...
> 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 Py=
thon does, for what little that's worth.
paul
Home |
Main Index |
Thread Index |
Old Index