zsh-users
 help / color / mirror / code / Atom feed
From: P.Stephenson@swansea.ac.uk
To: zsh-users@math.gatech.edu (Zsh users list)
Subject: Re: 2 questions
Date: Wed, 01 Nov 95 08:46:17 +0000	[thread overview]
Message-ID: <12607.9511010846@pygmy.swan.ac.uk> (raw)
In-Reply-To: "unpingco@ece.ucsd.edu"'s message of "Tue, 31 Oct 95 08:13:08 PST."             <9510311613.AA01212@sunshine.ucsd.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 <pws@ifh.de>       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.


  reply	other threads:[~1995-11-01  8:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-31 16:13 Jose Unpingco
1995-11-01  8:46 ` P.Stephenson [this message]
2000-04-18 18:24 Jason Price
2000-04-18 20:52 ` Oliver Kiddle
2000-04-19 14:25 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12607.9511010846@pygmy.swan.ac.uk \
    --to=p.stephenson@swansea.ac.uk \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).