in reply to Re: reuse STDOUT after it was closed
in thread reuse STDOUT after it was closed

Just wondering (spend too much time on a 'doz box), but would reopening STDOUT to /dev/tty work?

Replies are listed 'Best First'.
Re^3: reuse STDOUT after it was closed
by sgifford (Prior) on Mar 12, 2007 at 16:32 UTC
    The difference between restoring STDOUT and re-opening it to /dev/tty is the case where STDOUT wasn't originally connected to the user's terminal.

    For example, if the output was redirected to a file by the user starting the program, if STDOUT were restored any output after it was restored would go to the file; if it were re-opened to /dev/tty output would start out going to the file, but after STDOUT was re-opened further output would go to the terminal.

    It's not completely clear from the OPs question which behavior is desired, so it's quite possible opening /dev/tty is the right solution.