Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
Created January 15, 2015 00:40
Show Gist options
  • Save isomorphisms/04d9045eb1a7470573f8 to your computer and use it in GitHub Desktop.
Save isomorphisms/04d9045eb1a7470573f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
shopt -s expand_aliases
alias log='tee -a productivity.log; date >> productivity.log'
finished()
{
echo -e "\n\nDone!" | log
exit $?
}
trap finished SIGINT
interrupt()
{
echo -e "\n\nSomething went wrong." | log
exit $?
}
trap interrupt SIGKILL SIGTERM
#main program
echo -e "Begin $1.\n\n" | log
for minute in {1..15}
do
echo -n $minute
for seconds in {1..12}
do
sleep 5
echo -n ' .'
done
echo -e "\n"
done
echo $1 >> productivity.log
echo "You went over time, bozo." | log
unalias log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment