I have a data file, that when a flag file is created, the data file is encrypted. Here is an example of the data file name WSPGLOBAL.PAYMENTS.ISO20022_PAIN_01Ver3.66169592.xml and the flag file name SendPaysource.66169592 . I want to be able to pass the numeric part of the flag file name and only gpg the corresponding data file with that numeric value in the name.
I currently have a working script that does the gpg based on wildcards, but there may be a possibility that there is a second data file that is not ready to be sent and doesnt have the flag file.
#!/bin/bash
. /pbapps/pbmis/apps/apps_st/appl/APPSpbmis_ennycebs02.env
if [ -e /misc/pbmis/output/SendPaysource.* ];
then
gpg --always-trust --no-tty -se --passphrase xxxxxxxxx -r xxxxx.xxxxx.com /misc/pbmis/output/WSPGLOBAL.PAYMENTS.ISO20022_PAIN_01Ver3.*.xml
fi
Any advice is greatly appreciated.
As far as I understand it, you want to pass the flag file that corresponds to a data file only if it exists, this code will do the job: