Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (30 sloc) 654 Bytes
#!/bin/bash
# Change to the diary directory
# Set your DIARY_DIR in bashrc. else it goes into home folder.
cd $DIARY_DIR;
# Get current date
year=$(date +%Y);
month=$(date +%m);
# Create folders if they don't exist.
if [[ ! -d $year ]]; then
mkdir $year;
cd $year;
else
cd $year;
fi
if [[ ! -d $month ]]; then
mkdir $month;
cd $month;
else
cd $month;
fi
# Create diary files in the appropriate places and opens them.
# VIM > EMACS.
datename=$(date +%F)
if [[ ! -f "$datename.md" ]]; then
touch "$datename.md";
echo "## $datename, $(date +%A)" >> "$datename.md";
vim "$datename.md";
else
vim "$datename.md";
fi
You can’t perform that action at this time.