Skip to content

Instantly share code, notes, and snippets.

@dkordik
Last active March 22, 2017 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkordik/b6d43cfb27f97fdd6f136922dcd8dc8d to your computer and use it in GitHub Desktop.
Save dkordik/b6d43cfb27f97fdd6f136922dcd8dc8d to your computer and use it in GitHub Desktop.
Print out the execution time of a specified terminal command, 10 times
# Usage:
# ./time_command.sh "sleep 2"
# (or a command you actually care about timing, in quotes)
COMMAND="$1"
for N in {1..10}
do
printf "$N: "
( time `eval $COMMAND` ) 2>&1 | grep real | awk '{ printf $2 }'
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment