in reply to Re^2: Passing the contents of a file in a "system" call to a .ksh script
in thread Passing the contents of a file in a "system" call to a .ksh script
The following is a cut/paste of your code with the addition of use strict;use warnings;, the addition of variable declaration, removing your LOG line and substituting "echo" for "/home/admin/bin/email.ksh".
use strict; use warnings; my $LOGFILE = 'junk.txt'; open my $FH, "<$LOGFILE" or die "Failed to open $LOGFILE"; my @contents = (); while (my $LINE = <$FH>) { push @contents, $LINE; } close $FH; my @args = ("echo", "@contents", "Web Server Issue", "PROD", "/home/ad +min/logs/check_jvm/EmailAlert.log"); system(@args) == 0 or die "system @args failed: $?"
It echos The contents of the file. Web Server Issue PROD /home/admin/logs/check_jvm/EmailAlert.log as expected. Are you sure you are invoking your shell script properly? Can you invoke it successfully from the command line? If it comes down to debugging a shell script or perl, I'd be inclined to suggest putting time in on hbm's suggestion.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Passing the contents of a file in a "system" call to a .ksh script
by BrotherElwood (Initiate) on Jan 08, 2009 at 20:51 UTC | |
by kennethk (Abbot) on Jan 08, 2009 at 21:13 UTC | |
|
Re^4: Passing the contents of a file in a "system" call to a .ksh script
by BrotherElwood (Initiate) on Jan 08, 2009 at 21:31 UTC |