Skip to content

Instantly share code, notes, and snippets.

@blues911
Created June 1, 2020 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save blues911/34614f82bf9a334c96ddb58bf841d913 to your computer and use it in GitHub Desktop.
Save blues911/34614f82bf9a334c96ddb58bf841d913 to your computer and use it in GitHub Desktop.
Bash script to calculate elapsed time.
#!/bin/bash
SECONDS=0
echo 'Time Start:' $(date '+%Y-%m-%d %H:%M:%S')
# code...
echo 'Time End:' $(date '+%Y-%m-%d %H:%M:%S')
eval "echo Time Elapsed: $(date -ud "@$SECONDS" +'$((%s/3600/24)) days %H hours %M minutes %S seconds')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment