Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!oberon!bloom-beacon!mit-eddie!rutgers!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!ucsdhub!sdcsvax!ucbvax!ucbcad!zen!katerina!c188-bl From: c188-bl@katerina.uucp (Steven Brian McKechnie Sargent) Newsgroups: comp.unix.wizards Subject: Re: Redirecting shell output. Message-ID: <4445@zen.berkeley.edu> Date: Sun, 18-Oct-87 21:42:17 EDT Article-I.D.: zen.4445 Posted: Sun Oct 18 21:42:17 1987 Date-Received: Tue, 20-Oct-87 01:34:39 EDT References: <289@minya.UUCP> Sender: news@zen.berkeley.edu Reply-To: sarge@scam.Berkeley.EDU (Steven Brian McKechnie Sargent) Organization: University of California, Berkeley Lines: 21 Try the "exec" command of the Shell. The full syntax is exec [command] [redirections] [Redirections] is optional, in which case [command] runs with the default I/O; what most people don't know is that [command] is also optional, in which case [redirections] are applied to the running shell. So if you say words like exec 2>thump all standard-error redirections go to a file named "thump." Saying words like exec 14 >&2 exec 2>thump will save the old value of 2 in 14, redirect 2 into "thump." Later you can undo this with exec 2>&14 exec 14>&- which restores 2 from 14 and then closes 14. All this is documented in sh(1), but so tersely that you can skip right over it and never notice. S.