Created
August 9, 2017 15:37
-
-
Save nicdoye/4d78b35aa1518c977e727bb362cb4446 to your computer and use it in GitHub Desktop.
Minutes and Seconds from milliseconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contains a rounding error, but we didn't need the accuracy | |
# Check if $response is an empty string or not a number | |
if [ -z ${response} ] || [ $(( ${response} + 0 )) == 0 ] | |
then | |
mins=undef | |
secs=undef | |
then | |
else | |
mins=$(( ${response} / 1000 / 60 )) | |
secs=$(( ${response} / 1000 - 60 * ${mins} )) | |
fi | |
echo "$mins minutes and $secs seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment