Skip to content
Joachim Ansorg edited this page Nov 15, 2021 · 2 revisions

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

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally