SC3006 – ShellCheck Wiki

See this page on GitHub

Sitemap


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 is a static analysis tool for shell scripts. This page is part of its documentation.