Skip to content

Instantly share code, notes, and snippets.

@enagorny
Created January 15, 2014 10:30
Show Gist options
  • Save enagorny/8434016 to your computer and use it in GitHub Desktop.
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`
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