nnote/daynote

13 lines
321 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
NOTENAME="${1:-daily}"
DATEDIR="$NOTESDIR/$(date +%Y/%m/%d)"
mkdir -p "$DATEDIR"
NOTEPATH="$DATEDIR/$NOTENAME"
echo "$NOTEPATH"
if ! [ -f "$NOTEPATH" ]; then
printf "$NOTENAME for $(date +%Y/%m/%d)\n---\n\n" > "$NOTEPATH"
fi
$EDITOR "$NOTEPATH"