0

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?

Dilna
  • 405
  • 1
  • 6
  • Does this answer your question? [Check if bash variable equals 0](https://stackoverflow.com/questions/13086109/check-if-bash-variable-equals-0) – 0stone0 Dec 01 '21 at 10:01
  • It's not correct. See the bash man-page, section ARITHMETIC EVALUATION. – user1934428 Dec 01 '21 at 12:51

1 Answers1

0

This works in my bash:

if (( 1 != 2 )); then echo Y; fi
Y
D-FENS
  • 1,438
  • 8
  • 21