Created
December 22, 2011 23:30
-
-
Save nadavoid/1512319 to your computer and use it in GitHub Desktop.
Execute an arbitrary command and track how much time it takes, in seconds.
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
if [ "$1" ]; then | |
START=$(date +"%s") | |
echo "Doing: $1" | |
$1 | |
END=$(date +"%s") | |
ELAPSED=`expr $END - $START` | |
echo "Operation took $ELAPSED seconds." | |
else | |
echo "Usage: | |
exec_with_timer.sh 'command to run' | |
exec_with_timer.sh 'date' | |
exec_with_timer.sh 'drush cc all'" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment