Skip to content

Files

Latest commit

 

History

History
25 lines (15 loc) · 677 Bytes

SC2219.md

File metadata and controls

25 lines (15 loc) · 677 Bytes

Pattern: Use of let expr instead of (( expr ))

Issue: -

Description

The (( .. )) arithmetic compound command evaluates expressions in the same way as let, except it's not subject to glob expansion and therefore requires no additional quoting or escaping.

This warning only triggers in Bash/Ksh scripts. In Sh/Dash, neither let nor (( .. )) are defined, but can be simulated with [ $(( expr )) -ne 0 ] to retain exit code, or : $(( expr )) to ignore it.

Example of incorrect code:

let a++

Example of correct code:

(( a++ ))

Further Reading