Created
September 25, 2015 11:44
-
-
Save rshipp/e6667c660493cbaa27b8 to your computer and use it in GitHub Desktop.
take daily encrypted notes
This file contains 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 | |
# take notes | |
IDENT= # put your gpg key id (email) here | |
NOTES_DIR=~/.n | |
TMP_DIR=/dev/shm/.n | |
GPG=gpg | |
mkdir -p "$NOTES_DIR" || exit $? | |
mkdir -p "$TMP_DIR" || exit $? | |
date=$(date --iso) | |
file="$TMP_DIR/$date.md" | |
efile="$NOTES_DIR/$date.gpg" | |
if [[ -f $efile ]]; then | |
$GPG -o "$file" -d "$efile" | |
$EDITOR "$file" | |
else | |
$EDITOR "$file" | |
fi | |
while ! $GPG -o "$efile" -er $IDENT "$file"; do | |
read -p "something went wrong. fix it and hit enter to try again." _ | |
done | |
rm "$file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment