Clone
3
SC3006
Lucas Larson edited this page 2025-09-27 22:48:52 -04: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}" != 0 ]; then
  echo variable is not zero
fi