bug-bash
[Top][All Lists]
Advanced

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

Built-in `test -a` returns incorrectly


From: Klüver , Tibor
Subject: Built-in `test -a` returns incorrectly
Date: Mon, 18 Nov 2024 11:31:25 +0000

Hi,

please see below for the copy of bash-bug:

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -Wall
uname output: Linux SLWS573 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 
00:21:55 UTC 2024 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
        Built-in `[ -a ... ]` returns true when false, negation with `!` is 
also very strange.
        `[[` is not affected, neither is `/bin/[`.

Repeat-By:
        * touch file
        * [ -a file ] && echo exists         => exists
        * [ ! -a file ] && echo exists       => exists
        * [ ! ! -a file ] && echo exists     => (nothing)
        * [ ! ! ! -a file ] && echo exists   => (nothing)
        * [ ! ! ! ! -a file ] && echo exists => exists

        Any additional negation works correctly, with false and true 
alternating.

Best regards

Tibor Klüver
Softwareentwickler
[cid:image001.gif@01DB39B5.C84BDB80]
+49 172 6540798<tel:+49%20172%206540798>
kluever@safelog.de<mailto:kluever@safelog.de>
safelog.de<https://www.safelog.de/>
SAFELOG GmbH | Henleinstraße 4
85570 Markt Schwaben | Germany
Amtsgericht München HRB 114498 | USt-ID-Nr.: DE812095921
Geschäftsführer: Michael Wolter | Mathias Behounek | Michael Reicheicher

GIF image


reply via email to

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