all repos

dotfiles @ 08e75ea

i use rach linux btw

dotfiles/bin/gpe (view raw)

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