$(( )) arithmetic
Performs math operations.
Syntax
$(( expression ))
Description
Bash works with text by default; $(( )) is used for numeric operations. + - * / % are supported.
Example
Loading editor…
Expected output
7 1 10
When to use?
Counter, calculation.
Common mistakes
- ⚠️ Outside $(( )) 3 + 4 remains as text; required for arithmetic.