From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id TAA19153 for ; Wed, 1 Nov 1995 19:53:39 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA11190; Wed, 1 Nov 1995 03:44:51 -0500 Old-Return-Path: Resent-Date: Wed, 01 Nov 95 08:46:17 +0000 Old-Return-Path: Message-Id: <12607.9511010846@pygmy.swan.ac.uk> To: zsh-users@math.gatech.edu (Zsh users list) Subject: Re: 2 questions In-Reply-To: "unpingco@ece.ucsd.edu"'s message of "Tue, 31 Oct 95 08:13:08 PST." <9510311613.AA01212@sunshine.ucsd.edu> Date: Wed, 01 Nov 95 08:46:17 +0000 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-Id: <"RV3sf.0.Xk2.fDpbm"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/118 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu unpingco@ece.ucsd.edu wrote: > 1.) is it possible to assign standard output and/or standard error > from a job to a device after it has been put in the background. > > For example, > % find . -name '*mat' -print & > then do something like > % %1 > /dev/null There's no simple way of doing it, since that would require another process to intercept the input and redirect it. That could only happen if the target of the output is smart. In this case, it's just the terminal, which is completely unable to distinguish where the output is coming from. Here's one possible way. The following script, 'transout', reads lines from stdin and writes them to stdout by default. When you create a file called "newout", it reads a new file name from that and starts writing to that instead: #!/bin/sh while read line; do if [ -f newout ]; then exec >`cat newout` rm -f newout fi echo $line done Now do what you want, with '| transout' stuck on the end: % find . -name '*mat' -print | transout & Output now comes to stdout. If you do % echo /dev/null >newout then output will go to /dev/null instead. You can make this more sophisticated, obviously. > 2.) why is it that when I do history -f, I get dates and times that refer to > the latest login and not to the date and time of command execution in the > history. > > For example, > > 105 10/21/1995 09:44 cd News <--- this command was run 10/20 not 10/21 > 106 10/21/1995 09:44 mail -f z <-- this is correct Probably this is due to the problem with some versions of atol() which don't like the : following the history date and won't convert the number. This may have been fixed by now. -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.