bin/gpe (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#!/usr/bin/env bash
# For working this script set $GPG_KEY with gpg key
## Functions
encrypt() {
gpg -ea -r $GPG_KEY $@
}
decrypt() {
local f="$1"
if [ ${f: -4} == ".asc" ]
then gpg -d -o ${f%%.asc} $@
elif [ ${f: -4} == ".gpg" ]
then gpg -d -o ${f%%.gpg} $@
fi
}
## Case's
case "$1" in
enc|e) shift; encrypt $@ ;;
dec|d) shift; decrypt $@ ;;
*) echo "Error." ;;
esac
|