I find this behaviour counter-intuitive:
v=0; ((v)) && echo K; v=1; ((v)) && echo J
echoes:
J
but generally 0
is success:
f() { return 0; }; if f; then echo W; fi
Explain the reasoning?
man
page for (( ))
says:
If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1.
How best to check if a variable is zero using Arithmetic Evaluation?