On 9/6/24 11:44 AM, Ulrich Mueller wrote:

Bash Version: 5.2
Patch Level: 32
Release Status: release

Description:
        The following command does not error out, in spite of a
        semicolon missing before "then":
        $ if [[ x ]] then :; fi

        Previous versions (e.g. 4.4.23) used to report an error:
        bash: syntax error near unexpected token `then'

POSIX says that construct, even though the particular compound command
isn't part of the standard, should be accepted. Here's the report about
it, from a discussion about a broader topic:

https://lists.gnu.org/archive/html/bug-bash/2021-02/msg00140.html

All shells that implement [[...]] (bash/ksh/mksh/zsh) behave this way.
Bash changed in version 5.2.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to