aboutsummaryrefslogtreecommitdiff
path: root/scripts-build/sdep-add
blob: 7c25cdba7795969a888f4992e204da09a6b21e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

Generated with cgit - Back to sebastiano.tronto.net