Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
math no longer supports logical expressions #4777
I'm not sure if @krader1961's math implementation with muparser featured it, but the released version of fish that uses
Under fish 2.7.0, the following output is generated:
~> math 1 == 1; echo $status; 1 0 ~> math 1 == 0; echo $status; 0 1
(I stumbled across an old script of mine which used
Not sure what we want to do about this or how hard it would be to add in support, but in all cases we should make a decision either way whether this functionality is explicitly dropped or not. Naturally things like
It did. However, it did not return a failing status for a result of 0, so it wasn't really useful as a test. "a == b" just printed "1" when it was true and "0" otherwise.
The math function returned a status of 1 for a result of 0:
case 0 # For historical reasons a zero result translates to a failure status. echo 0 return 1
No matter the function. "==" just happens to have a result of 0 if the operands aren't equal.
For "==", actually surprisingly hard. This does char-comparison for operators to avoid having to strip whitespace or stop at the next token, so operators that are more than one character long pose a bit of a problem (I've thought about adding
In that case, I vote for dropping it. This is duplicated functionality, and always relied on a weird quirk (returning 1 on zero).
Use an explicit test.