Last active
August 29, 2015 14:24
-
-
Save thebinarypenguin/77e8a8b8246f954b9b70 to your computer and use it in GitHub Desktop.
Simple script for quickly capturing notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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