my @results = `/usr/bin/df -k`; # now stores all the lines of df -k # backticks seem to be working OK?
[snip] #everything here is in double quotes until you see another EOF print SENDMAIL <<EOF; From: <uid\@host> To: <email_acct\@acme.com> Subject: host disk usage host disk usage @results EOF [snip] -----Original Message----- From: McCormick, Rob E [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 5:29 PM To: perl beginners (E-mail) Subject: mailing captured output with template text Gang, Using 'df -k' in bash, I can get this to work acceptably: # mail the disk usage for a file system to a recipient 'uid' df -k /data/wrc |mailx -s 'host disk usage' [EMAIL PROTECTED] I'd like to use perl to surround the output of df -k with a simple text message. I used perldoc -q mail to find the code to use sendmail, but I'd like to extend the sendmail example slightly. My attempt below: ---------------------- #!/usr/bin/perl -w use strict; my $results = system (`/usr/bin/df -k`); # backticks seem to be working OK? open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die "Can't fork for sendmail: $!\n"; print SENDMAIL <<"EOF"; From: <uid\@host> To: <email_acct\@acme.com> Subject: host disk usage host disk usage print "$results\n"; EOF close (SENDMAIL) or warn "sendmail didn't close nicely"; --------------------------- The error condition that occurs: mail is created and sent, I receive it, but the content of the mail is: host disk usage print "65280 "; Any corrections you could offer that don't involve a module? Or is it best to install a module? Thanks, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]