Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lifejournal script - daily log from the command line (vim + git)
#!/usr/bin/env bash
cd $HOME/projects/lifejournal
today=$(date +%Y%m%d-%H%M%S)
new_fname="${today}.txt"
vim "${new_fname}"
if [ -e $new_fname ]; then
if [ $(wc -w $new_fname | grep -Eo "^([0-9]+)") -eq 0 ]; then
echo "empty file, removing"
rm -i "${new_fname}"
else
git add "${new_fname}"
git commit -m "journal ${today}"
git push origin master
echo "congrats for writing something new today!"
fi
else
echo "no file..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.