From c977c43cc4509a8329ace6460b03ae926295394f Mon Sep 17 00:00:00 2001 From: Gardouille Date: Sun, 18 Oct 2015 02:11:00 +0200 Subject: [PATCH] pomodoro.sh: use a hidden directory to store tasks informations. --- pomodoro.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pomodoro.sh b/pomodoro.sh index 53e044a..528f5db 100755 --- a/pomodoro.sh +++ b/pomodoro.sh @@ -3,9 +3,18 @@ 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="${HOME}/task.todo" +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 @@ -15,9 +24,9 @@ fi # Tiny timer while [ "${TIME}" != "${DELAY}" ] do + printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}" sleep 60 TIME=$((TIME+1)) - printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}" done exit 0