Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 2 questions
- X-seq: zsh-users 118
- From: P.Stephenson@xxxxxxxxxxxxx
- To: zsh-users@xxxxxxxxxxxxxxx (Zsh users list)
- Subject: Re: 2 questions
- Date: Wed, 01 Nov 95 08:46:17 +0000
- In-reply-to: "unpingco@xxxxxxxxxxxx"'s message of "Tue, 31 Oct 95 08:13:08 PST." <9510311613.AA01212@xxxxxxxxxxxxxxxxx>
unpingco@xxxxxxxxxxxx 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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author