Hi,
              Thanks for help me.

Regs,
Durai.

----- Original Message ----- 
From: "Jose Alves de Castro" <[EMAIL PROTECTED]>
To: "Durai" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 4:15 PM
Subject: Re: Running another program in current program


> First: you're missing a ';' (in the line where you're printing to the
> log file)
>
> Secondly: you're comparing $? with 0... now if I'm not mistaken, $? is 0
> if everything's ok, right? :-)
>
> So you probably want something like:
>
> #!/usr/bin/perl -w
> use strict;
>
> # ...
>
> open( FILE_LOG, ">log_file" );
>
> print FILE_LOG `perl $PRODUCT_DIR/tests/$MAIN_PRODUCTS_TESTS_STR/run`;
> if ($?) {
>   print "Error";
>   exit 0;
> }
>
>
>
> :-)
>
>
> On Thu, 2004-04-29 at 11:53, Durai wrote:
> > Hi,
> >            I have written many test cases using shell script. But now I
am
> > writting in perl. I have done like the following one:
> >
> > open(FILE_LOG,">log_file");
> >
> >   print FILE_LOG `perl $PRODUCT_DIR/tests/$MAIN_PRODUCTS_TESTS_STR/run`
> >   if( $? == 0)
> >   {
> >         print "Error";
> >         exit 0;
> >   }
> >
> > Is it correct?
> >
> > In shell script, I did like the following one:
> >
> >  . $PRODUCT_DIR/tests/$MAIN_PRODUCTS_TESTS_STR/run 1>file_log 2>file_log
> >                 if [ `echo $?` = 0 ]
> >                 then
> >                         echo "Error";
> >                         exit
> >                 fi
> >
> > What is the equivalent code in perl for above shell script?
> >
> > Thanks,
> > Durai.
> >
> > ----- Original Message ----- 
> > From: "Jose Alves de Castro" <[EMAIL PROTECTED]>
> > To: "Durai" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Thursday, April 29, 2004 3:30 PM
> > Subject: Re: Running another program in current program
> >
> >
> > > It's the same variable :-)
> > >
> > > $?      The status returned by the last pipe close, backtick (``) com-
> > >         mand, successful call to wait() or waitpid(), or from the sys-
> > >         tem() operator.
> > >
> > > For more info, man perlvar
> > >
> > > If you care to give it a test, here it goes:
> > >
> > > perl -e '`ls`;print $?'
> > > # prints "0" (hopefully)
> > >
> > > perl -e '`nonexistingcommand`;print $?'
> > > # prints "1" (unless you have some strange command on your machine...)
> > >
> > > HTH,
> > >
> > > jac
> > >
> > > On Thu, 2004-04-29 at 11:08, Durai wrote:
> > > > Hello All,
> > > >
> > > > In shell script file, I can call another program & checked the exit
> > status.
> > > > Like:
> > > >
> > > > ./prog2
> > > > if [ $? -ne 0 ]
> > > > then
> > > >         echo "Error"
> > > >         exit
> > > > fi
> > > >
> > > > How to do in perl?
> > > >
> > > > ANy help much appreciated.
> > > >
> > > > Regs,
> > > > Durai.
> > > >
> > > >
> > > > ---
> > > > Outgoing mail is certified Virus Free.
> > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004
> > > -- 
> > > Josà Alves de Castro <[EMAIL PROTECTED]>
> > > Telbit - Tecnologias de InformaÃÃo
> > >
> > >
> > > -- 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> > >
> > >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004
> -- 
> Josà Alves de Castro <[EMAIL PROTECTED]>
> Telbit - Tecnologias de InformaÃÃo
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to