SC2007 – ShellCheck Wiki

See this page on GitHub

Sitemap


Use $((..)) instead of deprecated $[..].

Problematic code

n=1
n=$[n+1]

Correct code

n=1
n=$((n+1))

Rationale

The $[..] syntax was deprecated in Bash 2.0 and replaced with the standard $((..)) syntax from Korn shell

Exceptions

None.

See also


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.