scripts/pomodoro.sh

33 lines
512 B
Bash
Executable File

#!/bin/sh
TIME=0
# Work on the task (default: 25 min)
DELAY=25
# Log informations
LOG_DIR="${HOME}/.pomodoro"
# Task information (name, path, …)
TASK_NAME="${1}"
TASK_PATH="${LOG_DIR}/current.task"
# Create the log dir
if [ ! -f "${LOG_DIR}" ]; then
touch "${LOG_DIR}"
fi
# Create the task file
if [ ! -f "${TASK_PATH}" ]; then
touch "${TASK_PATH}"
fi
# Tiny timer
while [ "${TIME}" != "${DELAY}" ]
do
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
sleep 60
TIME=$((TIME+1))
done
exit 0