Another way to do it (specially when output is more than one line) is
to open the output as a file handle:
open CMDOUT, "runthis |";
while(<CMDOUT>) {
# Do whatever you want
print "Got the expected output\n" if /^expected output/;
}
"Matt" == Matt Schneider <[EMAIL PROTECTED]> writes:
Matt> You could do something like this: $check_return = system
Matt> "runthis"; print "\'runthis\' exited with code
Matt> \'$check_return\'\n" if ($check_return != 0);
Matt> Matthew Schneider System Administrator / Programmer SKLD
Matt> Information Services, LLC 303.820.0863
Matt> -----Original Message----- From:
Matt> [EMAIL PROTECTED]
Matt> [mailto:[EMAIL PROTECTED]
Matt> Behalf Of AITHA, BHEEMSEN (SBCSI) Sent: Monday, May 10, 2004
Matt> 1:25 PM To: [EMAIL PROTECTED]
Matt> Subject: [Perl-unix-users] How to grab the output (return
Matt> code) of a shellscript
Matt> Hi,
Matt> I am executing a shell script using the 'system' command
Matt> from a PERL script. I want to grab the return code(output)
Matt> from the shell script and validate it in my PERL script. Cam
Matt> someone please explain me how to do that.
Matt> Thanx.. -Bheemsen
Matt> _______________________________________________
Matt> Perl-Unix-Users mailing list
Matt> [EMAIL PROTECTED] To unsubscribe:
Matt> http://listserv.ActiveState.com/mailman/mysubs
Matt> _______________________________________________
Matt> Perl-Unix-Users mailing list
Matt> [EMAIL PROTECTED] To unsubscribe:
Matt> http://listserv.ActiveState.com/mailman/mysubs
--
Nelson Ferreira
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs