Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active July 28, 2023 10:02
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/b6bb19b9d1806b42fbcee1ea5858d565 to your computer and use it in GitHub Desktop.
Save cellularmitosis/b6bb19b9d1806b42fbcee1ea5858d565 to your computer and use it in GitHub Desktop.
A Pomodoro timer for the macOS terminal

Blog 2020/6/23

<- previous | index | next ->

A Pomodoro timer for the macOS terminal

Here is a simple Pomodoro timer for the Mac command line.

When time is up, your Mac speaks the phrase "Hey Pomodoro, time's up!".

pomo.sh:

#!/bin/bash

# A Pomodoro timer for the macOS terminal.

set -e

if test -z "$1"
then
    echo "Usage: $( basename $0 ) <duration in minutes>" >&2
    exit 1
fi

minutes=$1

echo "Starting a Pomodoro timer of $minutes minutes."

i=0
while test $i -lt $minutes
do
    sleep 60
    i=$(( $i + 1))
    echo $i minutes elapsed
done

echo "Hey Pomodoro, time's up!"
say "hey pomodoro, times up"

Console output:

$ pomo.sh 45
Starting a Pomodoro timer of 45 minutes.
1 minutes elapsed
2 minutes elapsed
3 minutes elapsed
...
43 minutes elapsed
44 minutes elapsed
45 minutes elapsed
Hey Pomodoro, time's up!
@cellularmitosis
Copy link
Author

@CHAIYOMIN 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment