From 82bcfe3f25b1f0c08c93fd35497019b546e24ce2 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 8 May 2021 19:19:41 +0200 Subject: First commit, v0.1 --- scripts/sdep-add | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/sdep-add (limited to 'scripts/sdep-add') diff --git a/scripts/sdep-add b/scripts/sdep-add new file mode 100755 index 0000000..bb0b2c8 --- /dev/null +++ b/scripts/sdep-add @@ -0,0 +1,24 @@ +#!/bin/sh + +# Adds a line to SDEPDATA/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="SDEPDATA/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