Skip to content

Instantly share code, notes, and snippets.

@Mitrichius
Created February 19, 2024 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mitrichius/ceed0f0ebf1e5683c3bd72eeb0d4bb15 to your computer and use it in GitHub Desktop.
Save Mitrichius/ceed0f0ebf1e5683c3bd72eeb0d4bb15 to your computer and use it in GitHub Desktop.
"On This Day" bash script for daily notes
MONTH_DAY=`date +'%m-%d'`
YEAR=`date +'%Y'`
> ${FILE_RESULT}
find "${DIR_PATH}" -maxdepth 1 -type f -name "*-${MONTH_DAY}.md" -type f ! -name "${YEAR}-${MONTH_DAY}.md" -print0 | while read -d $'\0' FILE
do
FILE_NAME=$(basename "${FILE}")
printf "\n\n---\n${FILE_NAME}\n---\n\n" >> ${FILE_RESULT}
cat "${FILE}" >> ${FILE_RESULT}
done
${EDITOR} ${FILE_RESULT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment