#!/bin/sh if [ ! -z "$1" ]; then # Take the basename of the file passed in, i.e. something like # /home/brennen/notes/vimwiki/diary/2019-01-01.wiki, slice off the extension, # and treat it as a seed date: date="$(basename -s .wiki "$1")" date="$(basename -s .md "$date")" datestamp="$(date --date="$date" -I)" else # No filename given, nothing to work with, just use today: datestamp="$(date -I)" fi echo '== log ==' echo echo "{{{exec-raw find ./vimwiki/log -name '${datestamp}*.wiki' | sort | xargs grep --with-filename '%title'" echo '}}}'