I think this is what you want.
open (CHILD1, "$command 2>&1 |");
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?
Thanks
Lixin
-----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.
-- -- Jesse Thompson -- Division of Information Technology -- University of Wisconsin - Madison -- _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs