Common If Conditions

Existence checks

Exists

# -n: return true when value is not empty.
if [[ -n "${X}" ]]; then
  echo "X env variable not empty"
fi

Does not exist

# -z: returns true when value is empty.
if [[ -z "${X}" ]]; then
  echo "true when value is empty"
fi

Numerical equality checks

Not Equal

# -ne: not equal operator
if [ "${X}" -ne 0 ]; then
  echo "X is not equal to 0"
fi