Home > Net >  Compaing integers in bash
Compaing integers in bash

Time:12-02

I have been using integer comparisons with standard approach

(( n == 0 ))

But this time I want to check if the variable is not zero. But I have found that != is only for strings. Is this correct? How is this integer comparison customarily approached?

CodePudding user response:

This works in my bash:

if (( 1 != 2 )); then echo Y; fi
Y
  • Related