all repos

dotfiles @ e268665

my dotfiles

bin/gpe (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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