Boolean (/Logical) Operators

&& Logical AND $(( a != b ))
|| Logical OR $(( a > b ))
! Negation (inversion) $(( a >= b ))

 

  • The right side of && will only be executed if the EXIT STATUS of the left is zero (i.e. no errors).
  • || is the opposite and will only evaluate the right side if the left side exit status is nonzero.
  • If the EXIT STATUS evaluates to TRUE, it returns a zero. If FALSE it returns a nonzero.

*remember, it is the result of the EXIT STATUS that is being evaluated