Hi

I have a question about encrypting files with gpg, and then ensuring that the original isn't accessible. Sorry if a similar question to this has already been posted; I did a search and couldn't find the answer.

Basically, I have a plain text file that is used to store information such as my bank account number, credit card number, driving licence number, NI number, etc. I find that I frequently need these and don't like having to search around for them. For security, I have encrypted the file with gpg and then deleted the plain text version. I then wrote the following script, which I placed in my ~/bin directory.

Code:
 #!/bin/bash

EXPECTED_ARGS=1
ERROR=1
FILE_LOCATION="/home/xzi/Documents/personal/"

if [ $# -ne $EXPECTED_ARGS ]; then
    echo "ask expects exactly one search term."
    exit $ERROR
fi

cd "$FILE_LOCATION"

if [ ! -f info.txt.gpg ]; then
    echo "The encrypted info file is missing!"
    exit $ERROR
fi

if [ -f info.txt ]; then
    rm info.txt
fi

gpg info.txt.gpg

if [ -f info.txt ]; then 
    grep -i "$1" info.txt | cut -d: -f2-3
    rm info.txt
else 
    echo "Unable to decrypt file."
    exit $ERROR
fi

exit 0
This allows me to quickly search for an item and, after entering the password interactively, view the information. It seems to work as expected and is very useful. But I am concerned that there may be an obvious flaw, particularly with regard to temporary files still being left somewhere. I'm pretty new to Linux so I'm not too sure about this.

Is there any problem with using gpg like this, and are there any other files that should be deleted or precautions taken?

Any insight would be appreciated. Thanks.