Hi guys, I'm still struggling with finding a way to redirect STDERR to STDOUT...
I have created a perl script called testscript which does this: print "1. this goes to standard out\n"; warn "1. this goes to standard err\n"; warn "2. this goes to standard err\n"; and then i defined sys$error to goto sys$output...and i tried running it here... $ define/user sys$error sys$output $ perl testscript >test.txt $ type test.txt 1. this goes to standard err 2. this goes to standard err Why is it that the line that's supposed to goto stdout didn't appear in test.txt? Any help would be greatly appreciated. Thanks, Patrick -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 10:13 AM To: Li, Patrick Subject: RE: redirecting STDERR to STDOUT inside a program I'm just a lurker on the mailing list and a novice at Perl, so you may get a better answer from someone else, but.... STDIN, STDOUT, and STDERR are handled on VMS by three logicals, SYS$INPUT, SYS$OUTPUT, and SYS$ERROR. To point these to a particular place, outside the program, you just define the logical you want to point to the place you want. For example, to point SYS$ERROR to the same place as SYS$OUTPUT (which by default it is anyway), you give this command $ define sys$error sys$output To do this for the duration of the execution of one image (program), you do this: $ define/user sys$error sys$output The logicals are usually pointing to your terminal, in an interactive session: $ show logical sys$output "SYS$OUTPUT" = "_AMSCI7$NTY8170:" (LNM$PROCESS_TABLE) I don't know whether the redirect command '2>&1' would work, either. Sorry. Within a program, we usually handle the redirection by calling system routines to do the equivalent of the DEFINE commands. Cheers, --Bob van Keuren San Diego -----Original Message----- From: Li, Patrick [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 9:51 am To: '[EMAIL PROTECTED]' Subject: redirecting STDERR to STDOUT inside a program I have no knowledge of VMS and right now I'm trying to port a perl script from UNIX to VMS. The perl script uses open to call some commands and redirects its STDERR to STDOUT.. for example: open OUTPUT, "some_command 2>&1 |"; while( <OUTPUT> ) { #do stuff here } close OUTPUT; My question is, would "2>&1" work on VMS? I understand that that's just a UNIX shell syntax and I'm not sure if VMS would recognize that. If that doesn't work, what would you suggest that I do in order to create the same effect? Please advice and thanks in advance, Patrick
