Created
January 15, 2014 10:30
-
-
Save enagorny/8434016 to your computer and use it in GitHub Desktop.
Notify finish long running programs in console.
Command will be trated as longrunning if it took >= 10 seconds, and notification performed via `tput bel`
This file contains hidden or 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 timer_start { | |
timer=${timer:-$SECONDS} | |
} | |
function timer_stop { | |
timer_show=$(($SECONDS - $timer)) | |
if [[ $timer_show -ge '10' ]]; then | |
tput bel | |
fi | |
unset timer | |
} | |
trap 'timer_start' DEBUG | |
PROMPT_COMMAND=timer_stop | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment