Skip to content

Files

Latest commit

 

History

History
23 lines (14 loc) · 663 Bytes

SC2322.md

File metadata and controls

23 lines (14 loc) · 663 Bytes

Pattern: Use of doubly nested parentheses

Issue: -

Description

ShellCheck found doubly nested parentheses in an arithmetic expression. While the syntax for an arithmetic expansion is $((..)), this does not imply that parentheses in the expression should also be doubled. (x), ((x)), and (((x))) are all identical, so you might as well use only one layer of parentheses.

Example of incorrect code:

value=$(( ((offset + index)) * 512 )) 

Example of correct code:

value=$(( (offset + index) * 512 ))

Further Reading