Skip to content

Instantly share code, notes, and snippets.

@dylan-k
Created December 27, 2020 03:28
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 dylan-k/c5dd8381eafaf8a785a6956411f93341 to your computer and use it in GitHub Desktop.
Save dylan-k/c5dd8381eafaf8a785a6956411f93341 to your computer and use it in GitHub Desktop.
# daylog opener
# run this at startup to have notes ready
FILE=~/Journal/_posts/$(date +%Y)-$(date +%m)_DAYLOG.txt
MONTH=$(date '+%Y-%m')
DATE=$(date '+%a %Y-%m-%d %l:%M %P')
echo "$FILE"
if test -f "$FILE"; then
echo "$FILE exists."
sed -i "6i $DATE" $FILE
sed -i '7i --------------------------------------------------------------------------------\n\n\n' $FILE
code -g $FILE:9
else
echo "$FILE does not exist"
echo "---" >> $FILE
echo "title: daylog" $(date +%Y)-$(date +%m) >> $FILE
echo "date: " $(date +%Y)-$(date +%m) >> $FILE
echo "---" >> $FILE
echo >> $FILE
echo >> $FILE
echo "$DATE" >> $FILE
echo "--------------------------------------------------------------------------------" >> $FILE
echo >> $FILE
code -g $FILE:10
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment