Skip to content

Instantly share code, notes, and snippets.

@ollar
Last active December 26, 2015 10:19
Show Gist options
  • Save ollar/7135890 to your computer and use it in GitHub Desktop.
Save ollar/7135890 to your computer and use it in GitHub Desktop.
Console pomodoro
#!/bin/bash
echo -n "How many minutes would you like the timer to run? "
read limit
echo
echo "Timing $limit minutes..."
echo
counter=0
while [ $counter != $limit ]; do
let "remain = $limit - $counter";
let "slice = $remain%5"
printf "\r$remain minutes left...\n";
if [[ "$slice" -eq "0" ]]; then
notify-send "Pomidorka" "$remain minutes left...";
fi
sleep 60
let "counter = $counter + 1"
done
if [ $counter = $limit ]; then
echo
echo "Time's up - $counter minutes have elapsed!"
notify-send "Pomidorka" "Time's up - $counter minutes have elapsed!"
echo -e '\a' >&2
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment