Hi,
I am executing a shell script using the 'system' command from a PERL
script. I want to grab the return code(output) from the shell script and
validate it in my PERL script. Cam someone please explain me how to do
that.
Thanx..
-Bheemsen
___
Perl-Un
You could do something like this:
$check_return = system "runthis";
print "\'runthis\' exited with code \'$check_return\'\n" if ($check_return != 0);
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863
-Original Message-
From: [EMAIL PROTECTED
Thanx. That worked.
-Original Message-
From: Matt Schneider [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 12:45 PM
To: AITHA, BHEEMSEN (SBCSI); [EMAIL PROTECTED]
Subject: RE: [Perl-unix-users] How to grab the output (return code) of a
shellscript
You could do something like this:
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() {
# Do whatever you want
print "Got the expected output\n" if /^expected output/;
}
"Matt" == Matt Schneider <[EMAIL PROTECTED]> writes:
Matt>