Simple Journal Script

Hello Readers!

I was looking for a solution the other day to do some journaling. I was considering doing something like Google Drive but I figured that more often than not I just want to scrobble down a few thoughts and call it good. I decided to make a quick bash script to make journaling a one command task!

The only prerequisite for this script is to make a directory called “journal” in your home directory.

NOW=$(date +%Y-%m-%d)
if [ -s ~/journal/$NOW ]
	then echo ""
	else echo $'\nWeight:\nCalories:\nMoney Spent:' >> ~/journal/$NOW
nano ~/prasc/journal/$NOW

This script will make a file with today’s date as the title in the format YYYY-MM-DD so your journal entries will always be in order. It also has a conditional statement to check and see if the file already exists. If the file doesn’t exist it pre-fills in a few headers for me that I want to keep track of. For me this is my Weight, Calorie Intake, and Money Spent. This will later allow me to do some simple analysis on these figures using grep! If you want to be able to run this anywhere remember you can always make an alias that points to it or drop it in your /usr/local/bin folder.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s