bug-bash
[Top][All Lists]
Advanced

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

Re: Logical expression works does not work as expected


From: Chet Ramey
Subject: Re: Logical expression works does not work as expected
Date: Sat, 28 Dec 2024 14:15:14 -0500
User-agent: Mozilla Thunderbird

On 12/27/24 4:52 PM, Павел Fortovey wrote:
    I apologize. I found out that this behavior is not a bug.

    I didn't think that bash is such a strange scripting language with its
    own interpretation of the concept of logic.

AND-OR lists are left-associative and || and && have equal priority.

Your example is equivalent to

{ { printf 1 && printf 2; } || { printf 3; }; } && { printf 4; }

All Bourne-style shells work like this.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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