Keywords: maths
(Aside: I'm still looking for opinions on my previous post.)

As programmers, we are used to the concept that non-zero numbers are true, and the number zero (that celebrated, deplored, curiosity-inspiring singularity squatting in the centre of an uncountably infinite line of numbers stretching forever in both directions, and then some) is false. Indeed, in C programming, 1 is so often synonymous with truth and 0 with falsehood that truth and falsehood are often literally defined as being equal to those numbers:
#define TRUE 1
#define FALSE 0
This has a few odd mathematical consequences, such as the number 2 being doubly true (TRUE+TRUE). More interestingly, if you try to divide TRUE into equal parts, the result will be rounded down to FALSE. I think there's something in that for all of us.

But let us diverge from the topic of C programming, and once again speak more generally of the convention that all non-zero numbers are equally true.

However! This universally-accepted convention is not, in fact, as universally-accepted as all that. In fact, in bash scripting, the world of truth and falsehood is turned on its head, zero becoming true and non-zero becoming false! You may gasp in shock and horror, but I assure you that this is indeed TRUE, no matter which value you assign to TRUE!

What is this foul fiction? you cry! Alas, alack, have the Biblical revisionists finally taken over? Quick, somebody check if pi is equal to three!

Don't panic; your transcendental numbers are safe. Except from the terrorists. (This interjection is brought to you by the US government.) Indeed, on reflection I must admit there is some strange, strange elegance in this strange, strange concept.

For example, division by false is now routine. And is it not so that falsehoods cannot help but repeatedly divide us?

Furthermore, falsehoods are dirty, common things; no more remarkable in our lives than the mathematical properties of the number 14. But the number 0; aah, now there is a strange and wondrous thing, as truth is a strange and wondrous thing!

If my ramblings have not yet convinced you, consider this closing thought. If all non-zero numbers are true, then there are infinitely many truths and only one falsehood. However, as any man or woman may see, there exists more than one falsehood in the world. This leads one to suggest that the opposing scheme, containing but one truth and infinitely many falsehoods, is closer to reality.
In truth (hah!), it is not productive to think of truth as being a binary quantity; one thing can be more true than another thing without the former being absolutely true and the latter being absolutely false. Computers, sadly, are fundamentally binary.
Wait... So half-truths are now falsehoods?

Shit! I'm gonna have to find a new way to not lie to my supervisors!

That was pretty thought-provoking, Crispy. Mind boggling, but thought provoking.
I can't live after reading this mind-shattering article..
*goes to get his gun*
I'm so enlightened, now Flame Sage has to shoot me before himself -- way to go!
High-tech sorcery! Burn Crispy at the stake! I want him nice and crispy!
VB has 0 = true and 1 = false, so if we go on the premise that anything VB touches becomes suck, your philosophical argument instantly falls apart.
I like this concept!

Indeed, there can truly only be one ultimate truth... All others must approach that single, utmost truth...

This, then, suggests that as their number representations approach 0, statements approach this one, single truth... So then, a statement with a truth "value" of 5 is the equivalent of one whose value is -5?
Anyone else want to join me in my saying that I had absolutely no idea what Crispy was talking about until the last paragraph? I caught the Bash true = 0 thing, but I was looking for something in the other paragraphs that didn't pop out immediately. Further proof that all future reading should be forgone in exchange for nearly reading the last paragraph(s), be it in a blog post, article, or book. :P
0 is true in bash likely because a program that completes succesfully (truthfully?) returns an error code of 0.
It's the same way in DOS, generally -- and even in most C projects. Most C functions return 1 (or otherwise) for failure, 0 for success.

"One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs." --Robert Firth

This has actually inspired the convention where most programmers develop their procedures in the negative sense. For instance:

if(SomethingHasFailed()) {

This is partially because many programmers hate indentation. What with smart indents and all, however, I vastly prefer:

if(SomethingIsSuccessful()) {

...mainly because I'm an eternal optimist inside (even though I'm a pessimist outside).
Elation wrote:
VB has 0 = true and 1 = false, so if we go on the premise that anything VB touches becomes suck, your philosophical argument instantly falls apart.

You're wrong, because it doesn't! In VB, -1 is true and 0 is false. Go ahead and check if you like.

Why -1? Because -1 is all 1s in binary, and VB has no logical and/or/etc.; all its truth-table operators are binary operators. This mind-boggling awful flaw was corrected in VB.NET, but its legacy lingers.

Jon88 wrote:
0 is true in bash likely because a program that completes succesfully (truthfully?) returns an error code of 0.

Sure, that's the mundane reason. ;-)
Sadly the absolute truth and many falsehoods philosophy is unlikely to be followed in newer languages. Exceptions supersede this convention.
Well, though it might not need to be said (in a "Thank you Captain Obvious!" sort of way), I think the TRUE=1 and FALSE=0 philosophy has come about because of its parallel to binary itself... TRUE=ON and FALSE=OFF

It's almost a Good vs Evil kind of thing... Light vs dark... Positive vs Negative (errr, scratch this one)