#!/bin/sh JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org" echo '* :journal:' > /tmp/capture $EDITOR /tmp/capture if grep -q '^\*\s*:journal:' /tmp/capture then echo "Empty capture; ignoring" else echo "Storing capture in $JRNL" cat /tmp/capture > $JRNL fi