Skip to content

Instantly share code, notes, and snippets.

@markwk
Created November 25, 2018 03:17
Show Gist options
  • Save markwk/963a155a76b5a5a09b647eb907f61329 to your computer and use it in GitHub Desktop.
Save markwk/963a155a76b5a5a09b647eb907f61329 to your computer and use it in GitHub Desktop.
Generate plain text markdown file for morning pages.
#!/bin/bash
# Bash script to generate a daily morning pages template
# includes file name and various date references
cd /Users/markkoester/Library/Mobile\ Documents/9CR7T2DMDG~com~ngocluu~onewriter/Documents/Notes_TheArchive
file_date=$( date '+%Y-%m-%d' )
filename="mp_$file_date.md" # prepending mp to files named according to date.
if [ -f $filename ]
then
echo "File already exists. Skipping."
else
echo "Creating Morning Pages Template File"
touch $filename
# multi line comment
: '
Example
----
note-id: mp_2018-11-23
title: November 23, 2018
author: Mark Koester
date: 11/23/18 10:24
tags: #MorningPages
----
'
# template_text='test here'
echo "----" > $filename
echo "note-id: $filename" >> $filename
echo "title: $( date '+%b %d, %Y' ) -" >> $filename
echo "author: Mark Koester" >> $filename
echo "date: $( date '+%Y-%m-%d %T' )" >> $filename # format: 11/23/18 10:24
echo "tags: #MorningPages" >> $filename
echo "----" >> $filename
echo "" >> $filename
fi
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment