bug-bash
[Top][All Lists]
Advanced

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

Re: select syntax violates the POLA


From: Oğuz
Subject: Re: select syntax violates the POLA
Date: Mon, 5 Apr 2021 09:47:24 +0300

5 Nisan 2021 Pazartesi tarihinde konsolebox <konsolebox@gmail.com> yazdı:
>
> The manual itself may be lacking in some places but the syntax here is
> explicit. There's no reason to follow otherwise. These "other methods"
> can only be an implementation mistake or a compromise that's not
> exactly a supported functionality or feature. This case where () and
> {} are allowed to not end with semicolon before 'else' when others
> aren't is likely one.


These all work (as expected) on the development branch:

bash-5.1$ if : ; then case _ in esac else : ; fi
bash-5.1$ if : ; then for _ do : ; done else : ; fi
bash-5.1$ if : ; then [[ _ ]] else : ; fi
bash-5.1$ if : ; then (( 0 )) else : ; fi
bash-5.1$ if { : ; } then while { : ; } do break ; done else : ; fi
bash-5.1$

If they didn't that'd be a defect in the shell, POSIX allows these
constructs, and it also makes sense that a list separator is optional
between else and the preceding command when that command is terminated with
a reserved word.


> > 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).
>
> Then why does it not work with other keywords that begin a block?


It does work with then, do, elif, else, done, esac, and }.


-- 
Oğuz


reply via email to

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