#!/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