Can I get back stdout after redirection?

Jonathan I. Kamens jik at athena.mit.edu
Wed May 1 14:54:51 AEST 1991


In article <48186 at ut-emx.uucp>, pefv700 at perv.pe.utexas.edu writes:
|> Since the shell has already closed stdout's file descriptor, is it not
|> possible to reopen it?

  You can't get back stdout per se.  However, if stdout was pointing to your
terminal before the shell closed it, you can open "/dev/tty" to get a file
descriptor to write to the terminal.

|> (Also, how did stdout get opened in the first
|> place?  The shell inherited it from its parent, didn't it?)

  Yes.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.programmer mailing list