Last active
March 22, 2017 02:42
-
-
Save dkordik/b6d43cfb27f97fdd6f136922dcd8dc8d to your computer and use it in GitHub Desktop.
Print out the execution time of a specified terminal command, 10 times
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
# 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