diary-add (518B)
1 #!/bin/bash 2 GPG_KEYID=${DIARY_KEYID:-"83BB96DF"} 3 ENTRIES_DIR=${DIARY_DIRECTORY:-"/Users/synox/diary"} 4 5 if [ $# -gt 0 ]; then 6 for file in "$@"; do 7 dest="$ENTRIES_DIR/$(date +%Y-%m-%d-%H%M%S).${file##*.}.gpg" 8 gpg --output "$dest" --encrypt --armor --recipient "$GPG_KEYID" --yes --quiet "$file" 9 ls -la "$dest" 10 done 11 else 12 dest="$ENTRIES_DIR/$(date +%Y-%m-%d-%H%M%S).txt.gpg" 13 cat | gpg --output "$dest" --encrypt --armor --recipient "$GPG_KEYID" --yes --quiet - 14 ls -la "$dest" 15 fi