diary-add-hidden (602B)
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 stty -echo # disable echo of the commands you type 14 cat | gpg --output "$dest" --encrypt --armor --recipient "$GPG_KEYID" --yes --quiet - 15 stty echo # enable echo 16 ls -la "$dest" 17 fi