diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-22 09:10:09 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-22 09:10:09 +0100 |
| commit | d506146c55ffa28ed8f5ba2d7ebd496e60e6a8d4 (patch) | |
| tree | 892cbe9b74dd914bc5b7e6148a4cfe115eaf4f76 /scripts-build/sdep-add | |
| parent | 9902b66c098b51ac91785eb5d929a73b981ce08c (diff) | |
| download | sdep-d506146c55ffa28ed8f5ba2d7ebd496e60e6a8d4.tar.gz sdep-d506146c55ffa28ed8f5ba2d7ebd496e60e6a8d4.zip | |
added a script to check past events and notify
Diffstat (limited to 'scripts-build/sdep-add')
| -rw-r--r-- | scripts-build/sdep-add | 24 |
1 files changed, 24 insertions, 0 deletions
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 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Adds a line to /home/sebastiano/.local/share/sdep/once. It is possible to specify a date, which will be | ||
| 4 | # read by date -d and prepended to the input text. | ||
| 5 | # -d is a non-portable option of GNU date. On some other systems one can | ||
| 6 | # accomplish the same with the -j option. | ||
| 7 | |||
| 8 | # Usage: sdep-add [date] | ||
| 9 | # Example: sdep-add "next monday" | ||
| 10 | |||
| 11 | file="/home/sebastiano/.local/share/sdep/once" | ||
| 12 | date="" | ||
| 13 | |||
| 14 | [ -n "$1" ] && date=$(date -d "$1" +%Y-%m-%d) | ||
| 15 | |||
| 16 | [ -n "$date" ] && printf "$date " | ||
| 17 | |||
| 18 | read text | ||
| 19 | |||
| 20 | if [ -n "$text" ]; then | ||
| 21 | printf "${date}\t${text}\n" >> "$file" | ||
| 22 | else | ||
| 23 | echo "Event not saved" | ||
| 24 | fi | ||
