It is currently Sat, 04 Feb 2023 12:15:03 GMT



 
Author Message
 writing simultaneously to std output and a file
In the Korn shell is there a way of writing simultaneously to the screen and
a file , other than using a tee command?


 Mon, 21 Jul 2003 22:09:35 GMT   
 writing simultaneously to std output and a file

I don't use ksh, but I seriously doubt it. Tee is made for this purpose. If you
don't have it, it's easy to write (in C).

        david

--
FORTRAN was the language of choice
for the same reasonthat three-legged races are popular.
        -- Ken Thompson, "Reflections on Trusting Trust"



 Mon, 21 Jul 2003 18:48:16 GMT   
 writing simultaneously to std output and a file
In article <3A793EF0.A507...@hotmail.com>,
David Rubin  <dlru...@hotmail.com> wrote:

The problem with tee is that it mucks with the semantics of screen output -
that is, it only works on stdout (can't catch stuff sent to /dev/tty) and it
will probably end up buffering the output.

The best solution to this general problem is to use script - either the one
that is a standard part of Unix - or a custom version written in Expect.



 Tue, 22 Jul 2003 02:05:15 GMT   
 writing simultaneously to std output and a file
Try

cat <somefile> | tee -a <somefile1>

--
Uday Kiran Jonnala
408-447-6115
47L(R7)



 Tue, 22 Jul 2003 04:10:10 GMT   
 writing simultaneously to std output and a file
Geez, I never thought that using 'tee' as a substitute for 'tee' would
be useful knowledge to have - but I'll file that away!

Kevin

ps - in case the subtle sarcasm was missed, the poster said 'other than
using the tee command'

In article <3A79C2A2.C9750...@cup.hp.com>,
  Uday Kiran Jonnala <ud...@cup.hp.com> wrote:

Sent via Deja.com
http://www.deja.com/



 Tue, 22 Jul 2003 07:07:30 GMT   
 writing simultaneously to std output and a file

Err...(forgive my ignorace on this, but) what get's sent to /dev/tty? stderr?
How about

        % a.out >log 2> log.stderr &
        % tail -f log

        david

--
FORTRAN was the language of choice
for the same reasonthat three-legged races are popular.
        -- Ken Thompson, "Reflections on Trusting Trust"



 Tue, 22 Jul 2003 14:28:37 GMT   
 writing simultaneously to std output and a file
On Thu, 1 Feb 2001 14:09:35 -0000, "Billy the Kid" <alapa...@yahoo.com> wrote:

Maybe ;

awk '{print;print >"file.out" }'

But why?

L



 Tue, 22 Jul 2003 22:51:59 GMT   
 writing simultaneously to std output and a file

Not necessarily.  They're referring to code that does

int fd = open("/dev/tty", ...);
write(fd, "message", ...);

Nothing you do to stderr can affect this.

--

Nate Eldredge
neldre...@hmc.edu



 Wed, 23 Jul 2003 08:50:49 GMT   
 
   [ 8 post ] 

Similar Threads

1. redirection std output and std error from within the script

2. redirection std output and std error from within the script

3. Redirecting std error and std output Query!

4. Writing a larege data file and reading it simultaneously

5. how to attach tty to a std output of a background process

6. Can sound cards simultaneously handle input and output?

7. please help...question about how to get output of two commands simultaneously

8. zmodem with std input/output ????

9. How to redirect the output of the std .O/P


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software