Hi Craig,

As I understand it, perl calls a shell to run the command you specify so you 
should be able to use standard shell redirectors, as in:

open(INPUT,"$findCMD 2>&1|")  

which should DUP the stderr to stdout for you. (not tested)

Gary
On Tuesday 19 June 2001  4:09 pm, Craig Moynes/Markham/IBM wrote:
> Hi,
>      I am running several commands within my perl script (on AIX 4.3.3).
> These commands include find, chmod, etc.
> What I am wondering is if anyone has a sample script kicking around where
> they execute the command and check the return code, grabbing any output
> (stderr or stdout) and printing it in the error message.
>
> My problem right now is I am executing the commands and piping the output
> within the open command:
> open( INPUT, "$findCMD|" )
>
> If the find command fails then i loose the error message ( and the return
> code), but I can read the stdout into perl very easily.
>
> I'm looking for an small elegant solution (as the script is fairly small).
> But I will use suggestions involving the redirecting of output to seperate
> files if I have to.
>
> Thanks all :)
>
> -----------------------------------------
> Craig Moynes
> Internship Student
> netCC Development
> IBM Global Services, Canada
> Tel: (905) 316-3486
> [EMAIL PROTECTED]

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

Reply via email to