open SYSOUTPUT, " system( $systemcall ) | " or die "$0 some complaint here
$!";

$systreturn = <SYSOUTPUT> or die "$0 no return from system call $!";


----- Original Message -----
From: "Craig Inman" <[EMAIL PROTECTED]>
To: "John W. Krahn" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 2:44 PM
Subject: Re: STDOUT from system call


> No, I'm not trying to capture the output of any of these. 'zowner' tells
who the
> file belongs to, if it fails, it will not return any output. I have tried
using
>
> if (system ("zowner $claims[0]") != 1)
>     then claimsubmit the file
>
> but for some reason the 'zowner' program does not consistently returning a
true 1
> or 0. The only 100% way to be sure it worked is to very that it outputs
the real
> owner of the file.
>
> Thanks,
> Craig
>
>
> "John W. Krahn" wrote:
>
> > Craig Inman wrote:
> > >
> > > Trying to get this script to 'claimsubmit' ONLY if the system call
> > > returns STDOUT, but I'm having a little trouble getting my script to
> > > verify that and act accordingly.
> >
> > Do you mean you want to capture the output from claimsubmit?  Use
> > back-quotes (``) or qx//.
> >
> > > opendir DIRH, "$unknown" or die "Can't open: $!\n";
> >                 ^        ^
> > Quotes aren't required.
> >
> > opendir DIRH, $unknown or die "Can't open $unknown: $!\n";
> >
> > > foreach my $files (sort readdir DIRH)
> > > {
> > >     my @claims = (grep(!/^\.{1,2}$/, $files));
> >
> > grep() reads from a LIST and returns a LIST.  IOW grep is inappropriate
> > here
> >
> > my @claims = sort grep !/^\.{1,2}$/, readdir DIRH;
> >
> > foreach my $file ( @claims ) {
> >
> > >     if (system ("zowner $claims[0]"))
> > >     {
> >
> >     if ( system( 'zowner', $file ) == 0 ) {
> >
> > > #    (system("claimsubmit $claims[0]"));     <-- once it works, i'll
use this
> >
> >         system( 'claimsubmit', $file ) == 0 or warn "claimsubmit $file
> > failed: $?";
> >
> > >         print "claimsubmitting $claims[0] \n";
> >
> >         print "claimsubmitting $file\n";
> >
> > >     }
> > > }
> >
> > John
> > --
> > use Perl;
> > program
> > fulfillment
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to