dotfiles/bin/gpe
Smirnov Alexandr 351fd863ac Del openbox
2021-03-23 13:39:30 +02:00

20 lines
432 B
Bash
Executable file

#!/usr/bin/env bash
# For working this script set in $GPG_KEY you gpg key
## Functions
function encrypt() {
gpg -ea -r $GPG_KEY $@
}
function decrypt() {
local fn="$1"
if [ ${fn: -4} == ".asc" ]
then gpg -d -o ${fn%%.asc} $@
elif [ ${fn: -4} == ".gpg" ]
then gpg -d -o ${fn%%.gpg} $@
fi
}
case "$1" in
enc|e) shift; encrypt $@ ;;
dec|d) shift; decrypt $@ ;;
*) echo "Error." ;;
esac