sh Arithmetic Expansion Parameter Expansion

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Loop n times:

while [ $((i=${i:=0}+1)) -le "$n" ]; do
    echo line $i
done

Output for n=5:

line 1
line 2
line 3
line 4
line 5

Manipulating decimals:

$ i=3.14159; echo $((${i%.*}*2))
6
$ i=3.14159; echo $((${i#*.}*2))
28318


Got any sh Question?