Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer> uname output: Linux mj1 6.14.0-24-generic #24~24.04.3-Ubuntu SMP PREEMPT_DYNAMI>
Machine Type: x86_64-pc-linux-gnu

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

Description:

   I wrote a script in which I accidentally omitted a semicolon after a
   ]] and before a then. It didn't work for a colleague of mine using
   another version of Bash.

   Expectation: I expect a syntax error in the absence of a semicolon
   or a newline between the closing brackets and the then.

   Behavior with Bash 5.2.21: no error, the program behaves as if a
   semicolon was present.

Repeat-By:

   Run the following snippet:

   if [[ -z "" ]] then
      echo hello
   fi

   Expected behavior: syntax error

   Actual behavior: prints "hello"

Fix: (none provided)

Reply via email to