True or False ? |
2006-12-19
|
Sometimes I wonder what we could have done better with all the collective brain energy expended over shell tests and booleanity. Imagine solving an important problem with it ?
Instead, every so often we get to wrestle with the impications of
$ true; echo $?
0
$ false; echo $?
1
$ python
Python 2.4.4 (#1, Oct 23 2006, 13:58:00)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(True)
1
>>> int(False)
0
It's only two values. Maybe the problem was shell authors didn't know C, only shell ? You'd think this would have been worth standardizing on, where was Mr. Posix back then ?
Yes I realize the usefulness of being able to return different exit values from a program and the accepted practice of exit value 0 meaning "everything's fine, move along, nothing to see".