#!/pgp/perl5/bin/perl ##Sample script to grep perl program output use warnings; use strict; use feature qw{ say }; #Added env variable for exporting pgp LIB_PATH $ENV{LIBPATH} = "/xyz/lib"; my $program_output3 = qx(pgp --options --verbose 2>&1); if($program_output3 !~ /0:file wiped successfully/i) { print "Something went wrong\n"; print "$program_output3\n"; if($program_output3 =~ /3013:no keys found/i) { print "Customer key is not found. Cannot encrypt\n"; } elsif($program_output3 =~ /3090:operation failed, file not found/i) { print "File is not found. Check the path again\n"; } elsif($program_output3 =~ /1080:no private key could be found for decryption/i) { print "Private key not found on our keyring.\n"; } elsif($program_output3 =~ /3001:input file not found/i) { print "File is not found?\n"; } elsif($program_output3 =~ /1053:signing key not found/i) { print "Signing key to encrypt is not found in the keyring\n"; } elsif($program_output3 =~ /3011:invalid passphrase specified/i) { print "Check the passphrase used. \n"; } elsif($program_output3 =~ /3083:could not create output file/i) { print "Check if the output location is valid or has access permissions\n"; } elsif($program_output3 =~ /3028:multiple inputs cannot be sent to a single output file/i) { print "This is a weird one. Check if there are any wildcards in the filename or command\n"; } } else { print "$program_output3\n"; print "Command ran successfully\n"; }