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 ... :)

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

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

Plus of course there are 'constants':

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

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

Regards,

Brian.