Script for handling gpg encrypted files

############################################
#
# File:    geheim.sh
# Descr:   A small script to read/write files using
#               your own private GPG key
# Date:    24 March 2010
# Author:  Chris Vugrinec
# ############################################
# Define your variables here
tmpFileName=”output.txt”
privateKeyAdress=”chris@datalinks.nl”
clear
if [ “$1” == “” ]
then
   echo “”
   echo “Please give file as param: ”
   echo “”
   echo “”
   exit 127
else
   chris=`echo $1 | cut -d . -f 3`
   if [ “$chris” == “gpg” ]
      then
         echo “Decrypting file $1” gpg –decrypt $1 >$tmpFileName
         vi $tmpFileName gpg -e -r $privateKeyAdress –output $1 $tmpFileName
         rm -f $tmpFileName
      else
         echo “Encrypting file $1”
         gpg -e -r $privateKeyAdress $1
         echo “cleaning up original file $1”
         rm -f $1
   fi
fi