Tuesday, March 28, 2017

When 0 means true


What is the output of this ?



You probably guess correct, the output is "Yes", but probably for the wrong reason.

In Unix world, "0" means true, and "1" means false. In this case, the "[" operator is equivalent to "test 1", which evaluates to "0" (true).

Hence the output is "Yes" !








No comments:

Post a Comment