bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

improvement to BASH manpage


From: D. Hugh Redelmeier
Subject: improvement to BASH manpage
Date: Sun, 19 Jun 2005 17:42:45 -0400 (EDT)

I think that the descriptions of AND lists and OR lists in 
bash(1) could be improved.

Here is an excerpt from http://cnswww.cns.cwru.edu/~chet/bash/bash.html:

    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.

I think that the forms would be less ambiguous and more clear if they
were written as:
        pipeline && list
and
        pipeline || list

It would be equally correct to write
        list && pipeline
and
        list || pipeline
but I think that this form is slightly less intuitive.

Obviously the surrounding text needs to have references to command1
and command2 replaced.


The shell grammar uses the non-terminal "command".  I don't
immediately see where it is defined.  I guess that it is a "simple
command" or "compound command".  If so, the current definitions of OR
lists and AND lists seems wrong because it does not allow for
        x || y || z
or
        x && y && z
or
        x && y || z




reply via email to

[Prev in Thread] Current Thread [Next in Thread]