Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when calculating timing in ksh #25

@thinkerbot

Description

@thinkerbot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions