[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
- Re: select syntax violates the POLA, (continued)
- Re: select syntax violates the POLA, Greywolf, 2021/04/05
- Re: select syntax violates the POLA, Chet Ramey, 2021/04/05
- Re: select syntax violates the POLA, konsolebox, 2021/04/02
- Re: select syntax violates the POLA, Robert Elz, 2021/04/02
- Re: select syntax violates the POLA, konsolebox, 2021/04/05
- Re: select syntax violates the POLA, Greywolf, 2021/04/05
- Re: select syntax violates the POLA, Robert Elz, 2021/04/02
- Re: select syntax violates the POLA, Dale R. Worley, 2021/04/04
- Re: select syntax violates the POLA, Robert Elz, 2021/04/05
- Re: select syntax violates the POLA, konsolebox, 2021/04/05
- Re: select syntax violates the POLA,
Oğuz <=
- Re: select syntax violates the POLA, Dale R. Worley, 2021/04/07
- Re: select syntax violates the POLA, Robert Elz, 2021/04/08
Re: select syntax violates the POLA, Greywolf, 2021/04/05
Re: select syntax violates the POLA, konsolebox, 2021/04/01
Re: select syntax violates the POLA, Robert Elz, 2021/04/01