2 SC3006
Joachim Ansorg edited this page 2021-11-15 11:30:45 +01:00

In POSIX sh, standalone ((..)) is undefined.

Problematic code:

variable=1
if ((variable)); then
  echo variable is not zero
fi

Correct code:

bash supports standalone ((..)) natively.

For POSIX compliance, use

variable=1
if [ "${variable}" -ne 0 ]; then
  echo variable is not zero
fi