Skip to content

Instantly share code, notes, and snippets.

@andreineculau
Created October 8, 2013 10:56
Show Gist options
  • Save andreineculau/6882969 to your computer and use it in GitHub Desktop.
Save andreineculau/6882969 to your computer and use it in GitHub Desktop.
bash timer
# After seeing that Mac AppStore has all these timers (both dumb and "smart") that each cost 3 USD (for what?!),
# I think this will do for 0 USD and 5 minutes.
# Works wonders as `timer 5 fuck off` :)
[[ "`uname`" == 'Linux' ]] && alias say="espeak"
function timer() {
minutes=${1:-1}
steep=$(($minutes*60))
wakeup=${@:2}
wakeup=${wakeup:-"time's up"}
echo -e "Aye, aye!\nWaiting for $minutes minutes before $wakeup"
sleep $steep && say "$minutes minutes have passed, so $wakeup" & disown
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment