What am I wanting to see after make check on glibc.

Pascal J.Bourguignon pjb at informatimago.com
Sat Nov 8 08:08:21 PST 2003


Kevin P. Fleming writes:
> Pascal J.Bourguignon wrote:
> 
> > % true && echo yes || echo no
> > yes
> > % false && echo yes || echo no
> > no
> 
> I've never seen that before (obviously). I also can't find anything in 
> the bash documentation that states it should work that way, so I'd be 
> concerned about relying on it. Can anyone show me where the docs say 
> this is expected behavior?

man bash is clear about it:

       The control operators && and || denote AND lists  and  OR  lists,
       respectively.  An AND list has the form

              command1 && command2

       command2  is  executed  if, and only if, command1 returns an exit
       status of zero.

       An OR list has the form

              command1 || command2

       command2 is executed if and only if command1 returns  a  non-zero
       exit  status.   The return status of AND and OR lists is the exit
       status of the last command executed in the list.


The exit status of c1&&c2 is  that of the last command executed in the
list. When c1 returns a non  null status, then c2 is not executed then
the status of c1&&c2 is that of c1. Hence you can append ||c3 and have
it executed.

-- 
__Pascal_Bourguignon__
http://www.informatimago.com/



More information about the lfs-support mailing list