Date: Sun, 04 Apr 2021 20:27:15 -0400 From: wor...@alum.mit.edu (Dale R. Worley) Message-ID: <87wntha84c....@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. kre 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.