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