From d506146c55ffa28ed8f5ba2d7ebd496e60e6a8d4 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 22 Dec 2021 09:10:09 +0100 Subject: added a script to check past events and notify --- scripts-build/sdep-add | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts-build/sdep-add (limited to 'scripts-build/sdep-add') diff --git a/scripts-build/sdep-add b/scripts-build/sdep-add new file mode 100644 index 0000000..7c25cdb --- /dev/null +++ b/scripts-build/sdep-add @@ -0,0 +1,24 @@ +#!/bin/sh + +# Adds a line to /home/sebastiano/.local/share/sdep/once. It is possible to specify a date, which will be +# read by date -d and prepended to the input text. +# -d is a non-portable option of GNU date. On some other systems one can +# accomplish the same with the -j option. + +# Usage: sdep-add [date] +# Example: sdep-add "next monday" + +file="/home/sebastiano/.local/share/sdep/once" +date="" + +[ -n "$1" ] && date=$(date -d "$1" +%Y-%m-%d) + +[ -n "$date" ] && printf "$date " + +read text + +if [ -n "$text" ]; then + printf "${date}\t${text}\n" >> "$file" +else + echo "Event not saved" +fi -- cgit v1.3