Skip to content
Dave Tucker edited this page Sep 14, 2016 · 1 revision

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

Clone this wiki locally