#!/bin/bash # Written August 19, 2005 - Travis Morgan # Released under the GPL Version 2 email=imbezol@trebuchet.bigfiber.net # if the user specified a particular file to edit if [ $# = 1 ] ; then file="$1" file=`echo "$file" | sed -e 's/\.gpg$//'` # we need to decrypt the file before we can edit it if [ -f "$file.gpg" ] ; then gpg -o "$file" -d "$file.gpg" || { echo "Failed to decrypt $file.gpg" exit } rm "$file.gpg" # the file is already decrypted elif [ ! -f "$file" ] ; then echo "File $file does not exist." exit fi # we're starting a new file else day="`date "+%Y-%m-%d_%H:%M:%S"`" file="journal_$day" fi # do the edit aterm -fg white -bg black -e nano "$file" # encrypt the result gpg -r $email -a -o "$file.gpg" -e "$file" && rm "$file"