I'm fairly new to bash scripting (like a week or two).
I have a bash script I made to encrypt/decrypt using GPG and tar. Right now I have my --exclude hard coded into the script, but I'd like to make it a bit more dynamic and add the items to exclude as arguments when ruing the encrypt part of the script. Basically I'm trying to figure out a loop (or other option) to replace the exclusions below with argument values. Right now the arguments are assigned as follows: $1=Source $2=Destination $3=Filename $4=Recipient's public gpg key. What I'd like to accomplish is any arguments supplied for $5 and up be set as excluded files/directories. I've searched all over for loop options to create a variable concatenating --exclude and the supplied value, but I'm coming up empty. Thanks in advance for any assistance.
tar -cpJ --exclude ~/VirtualBox_VMs --exclude ~/Truecrypt_Volumes ${SOURCE} | gpg -e -r ${RECIPIENT} -o ${SAVEAS}
برچسب:
نویسنده: استخدام کار