Skip to content

Instantly share code, notes, and snippets.

@thebinarypenguin
Last active August 29, 2015 14:24
Show Gist options
  • Save thebinarypenguin/77e8a8b8246f954b9b70 to your computer and use it in GitHub Desktop.
Save thebinarypenguin/77e8a8b8246f954b9b70 to your computer and use it in GitHub Desktop.
Simple script for quickly capturing notes
#!/bin/bash
# Usage
#
# jot.sh - Open today's jot file
# jot.sh <text> - Append text (with timestamp) to end of today's jot file
jotsDir=~/jots/
todaysFile=$jotsDir$(date +%F).jot
# If jots directory doesn't exist, create it
if [ ! -d $jotsDir ]; then
mkdir -p $jotsDir
fi
# If today's file doesn't exist, create it
if [ ! -f $todaysFile ]; then
touch $todaysFile
fi
if [ $# -eq 0 ]; then
# Open today's file in editor
vim $todaysFile
else
# Append input to today's file
echo -e "$(date +%H:%M) > $*\n" >> $todaysFile
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment