Skip to content

Files

Latest commit

 

History

History
31 lines (18 loc) · 617 Bytes

SC1116.md

File metadata and controls

31 lines (18 loc) · 617 Bytes

Pattern: Missing $ for $((..)) expression

Issue: -

Description

You appear to be missing the $ on an assignment from an arithmetic expression var=$((..)).

Without the $, this is an array expression which is either nested (ksh) or invalid (bash).

Example of incorrect code:

var=((foo+1))

Example of correct code:

var=$((foo+1))

Exceptions

If you are trying to define a multidimensional Ksh array, add spaces between the ( ( to clarify:

var=( (1 2 3) (4 5 6) )

Further Reading