bug-bash
[Top][All Lists]
Advanced

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

Re: [patch #10070] toggle invert flag when reading `!'


From: Dale R. Worley
Subject: Re: [patch #10070] toggle invert flag when reading `!'
Date: Wed, 26 May 2021 21:55:47 -0400

>> >    [[ ! 1 -eq 1 ]]; echo $?
>> >    [[ ! ! 1 -eq 1 ]]; echo $?
>> > 
>> > would both result in `1', since parsing `!' set CMD_INVERT_RETURN
>> > instead of toggling it.

Definitely, the section of the man page for "[[" says that "!" is a
negation operator, so "! ! foo" must yield the same results as "foo".

> I will try this as:
>
>   $ [ 1 -eq 1 ]; echo $?
>   0
>   $ ! [ 1 -eq 1 ]; echo $?
>   1
>   $ ! ! [ 1 -eq 1 ]; echo $?
>   0

That last one isn't defined by the manual page.  I'm surprised you don't
get a syntax error.

   Pipelines
       A pipeline is a sequence of one or more commands separated  by  one  of
       the control operators | or |&.  The format for a pipeline is:

              [time [-p]] [ ! ] command [ [|||&] command2 ... ]

Dale



reply via email to

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