Cai, Lixin (L.) wrote:

> I am thinking I did not describe the problem clear, the following is my
> code -- test.pl
> 
> ###########################################
> #!/usr/bin/perl
> 
> my $ldapsearch = "/usr/bin/ldapsearch";
> my $command = "$ldapsearch -x -LLL -h \"cds2.ford.com\" -b \"ou=People,
> o=Ford,c=US\" \"uid=lcai3\" uid fordUNIXid";
> print "$command\n";
> my $pid = open (CHILD1, "$command |");
> #############################################
> 
> If the command get any correct result, it will go to the handle
> --CHILD1, but if there is any error, it will output to the terminal, how
> can I redirect th error to the handle -- CHILD1?

Same thing - just add the redirection before the pipe.

open (CHILD1, "$command 2>some_file |");

> -----Original Message-----
> From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 29, 2004 11:07 AM
> To: Cai, Lixin (L.)
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Perl-unix-users] How can I redirect STDERR to a file?
> 
> 
> Cai, Lixin (L.) wrote:
> 
>>I have a question,
>>
>>How can I redirect STDERR to a file, insead of output to the terminal?
> 
> 
> Depends on your shell syntax.
> 
>       perl fubar.pl 2>some_file
> 
> should get it if you're not using {t}csh.
> 


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to