LANGUAGE » SHELL_SCRIPT » BASH » SYNTAX

Arithmetic

Those expressions are evaluated to a number.

Integer

shell
$(( 5+2 ))
$(( 5-2 ))
$(( 5*2 ))
$(( 5/2 ))
$(( 5%2 ))
$(( 5**2 ))

(( count+=1 ))

Decimal

Package bc is required.

shell
'10.5+2.5' | bc -l
'10.5-2.5' | bc -l
'10.5*2.5' | bc -l
'10.5/2.5' | bc -l
'10.5^2.5' | bc -l
'sqrt(10.5)' | bc -l