Good Morning Guys,
I have a quick question regarding a for loop I'm constructing.
I need to get an output filename from an existing file by removing the last part of the file extension and then use that as an output filename in a decryption command.
I've got the following:
Code:
for i in $FILES;
do basename $i | cut -d'.' --complement -f3
gpg --batch --passphrase-file /root/.gpgpass --output
done
In the variable $FILES I have a list of files with the extension .csv.pgp
The first command works and returns the same filename with an extension of .csv - however I can't seem to store that filename in a variable... I need to put something at the end of the GPG command --output to give the decrypted file the name .csv
For example, $FILES may contain the following files:
230614093023.csv.pgp
230614101435.csv.pgp
My loop needs to decrypt the above files, and name the output the same as above but without the PGP. I tried decrypting without an output filename thinking it may do it that way as standard, but it seems to require an output filename.
I'd be as always really grateful for any advice
Thanks
Jon