blob: 447d773391a84a2f2e60298b242162d95f266a68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/bin/sh
# The Korn-style arithmetic builtins: typeset -i and let, with $(( ))
# for the value. (( )) as a command is ksh93, not ksh88, so it has its
# own benchmark (dparen.sh). Shells without these are reported as n/a.
# shellcheck disable=SC2034 # the probe only has to assign an integer
( typeset -i p=1 ) 2>/dev/null || exit 3
typeset -i n=0
i=0
sum=0
while [ $i -lt 200000 ]; do
sum=$((sum + (i % 100) * 2))
let "i = i + 1"
n=n+1
done
echo "$i $sum $n"
|