Created
April 24, 2017 18:38
-
-
Save nikhita/c3736a2cf9f116d555d5acf59794920a to your computer and use it in GitHub Desktop.
A script to show how long a command took to run. Outputs the time on the right.
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
function preexec() { | |
timer=${timer:-$SECONDS} | |
} | |
function precmd() { | |
if [ $timer ]; then | |
timer_show=$(($SECONDS - $timer)) | |
export RPROMPT="%F{cyan}${timer_show}s %{$reset_color%}" | |
unset timer | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment