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