Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!pyramid!uccba!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: comp.unix.wizards Subject: Re: Redirecting shell output. Message-ID: <4925@ncoast.UUCP> Date: Thu, 22-Oct-87 18:31:50 EST Article-I.D.: ncoast.4925 Posted: Thu Oct 22 18:31:50 1987 Date-Received: Sun, 25-Oct-87 14:30:46 EST References: <289@minya.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 17 As quoted from <289@minya.UUCP> by jc@minya.UUCP (John Chambers): +--------------- | Hi, folks. Here's my shell puzzle of the day. We all learn in our first | hour of Unix lessons how to redirect input and output of any command that | is started by a shell. What I'd like to know is: Is there a "right" way | to tell the shell to redirect the output of ALL subsequent commands to a | file? +--------------- Nonintuitive, ugly, and while it's documented it took me years to figure out that this was what they meant: Start your script with "exec >file 2>&1". (Note that you don't actually exec anything, all you give are the redirections.) -- Brandon S. Allbery necntc!ncoast!allbery@harvard.harvard.edu {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery