#!/bin/bash # store: encrypt this directory using public key of $USERNAME (you) # if store.tar.gpg already exists in this directory, # do nothing, since another process is already using it # or it is left over because you aborted this store run if [ -e store.tar.gpg ] then echo -e "\007store.tar.gpg already exists in this directory $(pwd)" echo "nothing done" exit 1 fi # tar, encrypt, and remove all files tar --exclude=store.tar.gpg -c -v -f - .|gpg --encrypt -r $USERNAME -o store.tar.gpg /bin/ls -A|grep -v store.tar.gpg|tr '\n' '\0'|xargs -0 /bin/rm -rf /bin/ls -l store.tar.gpg |awk '{print $5,$6,$7,$8}' echo "completed encrypted store -> store.tar.gpg" exit 0