ts
ts copied to clipboard
Error when calculating timing in ksh
I've observed the following:
./Projectfile shell centos
/bin/ksh
ln -sf /bin/ksh /bin/sh
./test/pass
# .
#
# ./test/pass[8]: .: line 269: 0.092 - 0.041: arithmetic syntax error
The root cause appears to be ksh being unable to handle floating point math, which occurs when calculating run time https://github.com/thinkerbot/ts/blob/master/bin/ts#L269
# echo $((1 + 2))
3
# echo $((1.1 + 2.2))
/bin/ksh: 1.1 + 2.2: arithmetic syntax error
Possibly use bc
instead of shell math.