Issue
In bash, I don't understand why the 3rd command isn't true:
[[ 1 -eq 1 ]] # $? is 0
[[ ! 1 -eq 1 ]] # $? is 1
[[ ! ! 1 -eq 1 ]] # $? is 1 (??)
[[ ! ( ! 1 -eq 1 ) ]] # $? is 0
It seems to do the same thing if I replace 1 -eq 1
with any true expression, and negate with any false expression.
Solution
When parsing !
, bash sets a flag to the following expression to tell it to invert its result. Because of this, parsing two or more !
is equivalent to parsing a single !
. I proposed a patch to fix this, and it got accepted.
Answered By - vimene