From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22837 invoked from network); 11 Mar 1999 16:33:59 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 11 Mar 1999 16:33:59 -0000 Received: (qmail 26619 invoked by alias); 11 Mar 1999 16:29:57 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2216 Received: (qmail 26600 invoked from network); 11 Mar 1999 16:29:54 -0000 X-Authentication-Warning: awayteam.zanshin.com: schaefer set sender to schaefer@tiny.zanshin.com using -f From: Bart Schaefer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14055.61229.103383.508701@awayteam.zanshin.com> Date: Thu, 11 Mar 1999 08:28:29 -0800 (PST) To: "Michael Barnes" Cc: zsh-users@sunsite.auc.dk Subject: Re: redirecting stdio/stderr from a suspended then bged job In-Reply-To: <19990311105427.A6589@vt.edu> References: <19990311105427.A6589@vt.edu> X-Mailer: VM 6.68a under Emacs 20.3.5.1 Reply-To: Bart Schaefer Michael Barnes writes: > This has been bugging me for a while. How can I suspend a job that is > taking longer than I expect and then put it in the background and then > redirect stdio and/or stderr to a file (or /dev/null) ? You can't. The I/O descriptors are all established before the job is started the first time, and then once it is running they're completely under the control of the job itself; the shell can't change them again. If you think about it, it has to work this way; imagine the havoc that could be wrought if a process couldn't guarantee that all writes to the same descriptor are going to go to the same place. The only thing you can do is to guess what jobs might take a long time, and redirect their output somewhere when you start them. If that place is a file and you later want to see some of the output, you can run "tail -f" or whatever. There are some tricks you could play with named pipes or the zsh coproc, but they all require that the redirection be specified when you first type out the command.