BC> On Sun, Oct 27, 2002 at 06:28:04PM +0900, Giuseppe Bilotta wrote:
>> > > 1. Why couldn't one swap 'true' and 'false' in your square-bracket
>> > > comments in the above?
>> > 
>> > You mean like in Unix, where 0 means success and non-zero means failure?
>> 
>> This is true under DOS as well (errorlevel 0 => success), but just 
>> because non-zero means "there was an error", so it *is* true, and 
>> zero is false (no error).
>> 
>> Of course if you're an optimist and look at it from the "success" 
>> viewpoint ... :)

BC> But the shell 'operators' treat 0 as true and 1 as false, if you use the
BC> traditional definitions of 'and' and 'or':

BC> cmd1 && cmd2 && cmd3         # if cmd1 returns 0 exec cmd2, etc
BC> cmd4 || cmd5                 # if cmd4 returns non-zero exec cmd5

BC> Plus of course there are 'constants':

BC> $ false; echo $?
BC> 1
BC> $ true; echo $?
BC> 0

BC> That makes it pretty explicit that 0 = true :-)

Looks like all shells are optimists! :)

(Ok, point taken, and no I don't know why. Because it wouldn't be
that clean otherwise?)

-- 
Giuseppe "Oblomov" Bilotta