summaryrefslogtreecommitdiffstats
path: root/test/bashisms/arith.sh
blob: 2cbe860571cc61384f6ba12644224edb959cf9a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
metric=0
echo $((metric=metric+1))

m=0
n=2
echo $((n-m++)) # BASHISM
echo $((++m))   # BASHISM
echo $(( m-- )) # BASHISM
echo $((--m))   # BASHISM

foo_bar=0
echo $((foo_bar++)) # BASHISM
echo $((foo_bar=foo_bar*2))
echo $((foo_bar*3/6))

echo $((2*n++)) # BASHISM

echo $(($n*n++)) # BASHISM

echo $((3**2)) # BASHISM