conditional binary operator expected

81
  1. You're missing $ in front of var when you call it, like you wrote it, it will be literally var.
  2. Consider possible vulnerabilities of your script when using [[ ... ]] or (( ... )) together with variables you cannot control. In your case, it might be better to use [ "$var" -ne 0 ].
  3. You're missing a space between != and 0 (this is the source of the error!)
  4. != is a string comparison operator, while it might work in your example, you want to use -ne to compare integers.

Make use of shellcheck.

Share:
81

Related videos on Youtube

JayminLimbachiya
Author by

JayminLimbachiya

Updated on September 18, 2022

Comments