[Top][All Lists]

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

Re: select syntax violates the POLA

From: Robert Elz
Subject: Re: select syntax violates the POLA
Date: Mon, 05 Apr 2021 11:45:05 +0700

    Date:        Sun, 04 Apr 2021 20:27:15 -0400
    From:        worley@alum.mit.edu (Dale R. Worley)
    Message-ID:  <87wntha84c.fsf@hobgoblin.ariadne.com>

  | The manual page says
  |        if list; then list; [ elif list; then list; ] ... [ else list; ] fi
  | so clearly there should be a ; or newline before the list in the
  | else-clause.

You're assuming that the manual is a precise specification of what
is allowed.  It isn't.  At least in this case it shows something that
works, so if you write an if statement that way, it will function.
That does not imply that there are not other methods.

In general, when reading the bash man page, anywhere it says "list;"
(except apparently in select statements) you should read that as meaning
the same as the POSIX compound_list, and the ';' there is just an
indication that something must ensure that the word that follows is
correctly interpreted as a reserved word (when one is required).  A ';'
will do that.   So do other things.


ps: you can also use '&' in place of ';' or newline, when a separator
is required.   Though that gives the preceding command a different
operational behaviour of course.

reply via email to

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