When executing this command, don't forget to redirect the STDERR to STDIO,
else you won't be able to figure out the reason why command has failed, so i
will suggest following
my $result = `CTMORDER -SCHEDTAB EM-$ENV-REPORT-LOGS -JOBNAME
EM-$ENV-$Client_Key-AAL-EMAIL -ODATE ODAT -FORCE Y 2>&1`;
so result will hold any output message or error message and to know the
status of the command just echo "$?"
On Wed, Jun 24, 2009 at 10:27 PM, Jeff Soules <soules@...> wrote:
>
>
> Maybe the backtick operator ` `? (Backtick on my keyboard is the
> tilde key ~ without shift, but it might be different on your
> keyboard).
>
> So in place of:
>
>
> > system 'CTMORDER -SCHEDTAB EM-$ENV-REPORT-LOGS -JOBNAME
> > EM-$ENV-$Client_Key-AAL-EMAIL -ODATE ODAT -FORCE Y';
>
> You'd do
>
> my $result = `CTMORDER -SCHEDTAB EM-$ENV-REPORT-LOGS -JOBNAME
> EM-$ENV-$Client_Key-AAL-EMAIL -ODATE ODAT -FORCE Y`;
>
> and then look in $result for whatever the other utility would normally
> print on the screen.
>
> $? is supposed to be set the same way for system() as for the backtick
> operator, but maybe your other Windows program isn't returning a
> status properly or something?
>
> On Tue, Jun 23, 2009 at 9:33 PM, Kevin
Patterson<kpatters@...<kpatters%40berkeley.edu>>
> wrote:
> >
> >
> >
> >
> > Hi,
> >
> > I am writing a perl program to call/ execute another windows program
> >
> > Using the system command.
> >
> > I am trying to get/print the results to see if the command worked.
> >
> > Is there a way to capture the output of what the program ran??
> >
> > I tried using system ' ' and system(). I get the same results.. nothing..
> >
> > Here is my code so far.
> >
> > #!/usr/bin/perl
> >
> > # use strict;
> >
> > # use warnings;
> >
> > @client = qw(EM AS);
> >
> > #@client = qw(EM HR KR AS BF DB);
> >
> > my $eNV = "QW-D";
> >
> > my $T = '"';
> >
> > foreach $Client_Key (@client)
> >
> > {
> >
> > system 'CTMORDER -SCHEDTAB EM-$ENV-REPORT-LOGS -JOBNAME
> > EM-$ENV-$Client_Key-AAL-EMAIL -ODATE ODAT -FORCE Y';
> >
> > print "Status: $? $!\n";
> >
> > }
> >
> > [Non-text portions of this message have been removed]
> >
> >
>
>
--
Regards
Vishal Thakur
+919923206953
[Non-text portions of this message have been removed]