Redirecting STDERR to file then back to terminal? 
Author Message
 Redirecting STDERR to file then back to terminal?

If I want to temporarily redirect standard error messages to a file,
then later direct it back to the screen again, is it as simple as this
(which appears to work):

open (STDERR, ">temp_err.log");

   (first batch of error messages go to temp_err.log)

open (STDERR, ">-");

   (second batch of error message return to being output to screen)

Originally I tried closing STDERR in between the two "opens", but that
resulted in the second batch of error messages just being lost (neither
in temp_err.log or on screen).

It just seems wrong to do the second open on STDERR without first
closing it, or am I fretting about nothing?


---Tom Turton

Mon, 05 Mar 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. writing to terminal even with STDOUT and STDERR redirected

2. Redirect STDOUT from a Unix script to a perl program and then redirect back to script

3. assigning STDERR whild redirecting STDOUT to a file

4. Redirecting STDERR to a file

5. Redirecting STDOUT/STDERR to a file

6. redirect stderr and stdout to same file

7. redirect stderr and stdout to the same file

8. how to redirect stderr and stdout to same file

9. STDERR for back-tick commands?

10. fetch back STDERR outputs

11. How get back redirected STDOUT to its default?

12. Redirect output back to console


Powered by phpBB® Forum Software