bug-bash
[Top][All Lists]
Advanced

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

Logical expression works does not work as expected


From: Павел Fortovey
Subject: Logical expression works does not work as expected
Date: Fri, 27 Dec 2024 21:54:26 +0300

   Machine: x86_64

   OS: linux-gnu

   Compiler: gcc

   Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat
   -Werror=format-security -Wall

   uname output: Linux pve-lab 6.8.12-5-pve #1 SMP PREEMPT_DYNAMIC PMX
   6.8.12-5 (2024-12-03T10:26Z) x86_64 GNU/Linux

   Machine Type: x86_64-pc-linux-gnu



   Bash Version: 5.2

   Patch Level: 15

   Release Status: release



   Description:

          in a logical expression of the form "true && true || false &&
   false" the first two are executed, but unexpectedly the last value
   "false" is executed. i.e. the command "printf 1 && printf 2 || printf 3
   && printf 4" will give "124" instead of the expected answer "12"

   Repeat-By:

           bash -c "true && true || false && echo bug"


reply via email to

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