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

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

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