I want to convert a shell script code in Perl and use exec to execute the code. I have program written in perl but on a condition i have to add a code which i know how we can do in shell script but not sure how we can do in perl.
Shell Script Code:
(
echo "MIME-Version: 1.0"
echo "Subject: "
echo "Content-Type: text/html"
cat <emailbody>
) | mailx -r "[email protected]"
My Perl Code:
!/usr/bin/perl
use strict;
use warnings;
my $mailx = "/usr/bin/mailx";
if($ARGV[0] eq "ty" && $ARG[1]){
/// Here we want to use the shell script code .
}
my @args_to_pass = ($mailx, @ARGV);
exec @args_to_pass;
mailxexist, which differ (a lot) in how to specify headers. Evensendmailis better (more consistent) -- can you use that instead?