Skip to content

Instantly share code, notes, and snippets.

@antenore
Created June 9, 2016 22:39
Show Gist options
  • Save antenore/ee35a1f3b7b59830ee9c13c84e54c94d to your computer and use it in GitHub Desktop.
Save antenore/ee35a1f3b7b59830ee9c13c84e54c94d to your computer and use it in GitHub Desktop.
Shell script to measure elapsed time (bash, zsh, ksh)
#!/usr/bin/env bash
SECONDS=0
START=$(date '+%Hh%M')
echo "This scripts measure How many seconds last the script"
echo "Press any key when you are ready"
read a
END=$(date '+%Hh%M')
if [ $SECONDS -ge 60 ] ; then
echo "$START, $END, $[$SECONDS / 60] min"
else
echo "$START, $END, $SECONDS sec"
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment