Hello,
I'm trying to find a way to save my screen output to file and yet still see it display on the terminal. i thought about piping it into a file, but then i won't be able to see it on the screen as well.. anyone have any work-arounds?
thanks.
Hello,
I'm trying to find a way to save my screen output to file and yet still see it display on the terminal. i thought about piping it into a file, but then i won't be able to see it on the screen as well.. anyone have any work-arounds?
thanks.
I believe *nix has tee, otherwise just output both to a file and the stdout.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
i want to be able to run my program, output to a file, and still see the output on the screen as well. i have one of those run away loops and i need to see the state that it occurs. its a client-server program so and the server port is also displayed to he screen. without the port, it can't connect from the client.
Allow a command-line parameter that's the file name to output to. If one is given, also output to that.
Heck, you could even allow multiple file outputs with a simple loop.
some shells in *nix also deem the >> as meaning to file and stdout.
PHP and XML
Let's talk about SAX
> some shells in *nix also deem the >> as meaning to file and stdout.
Which ones, so I know to avoid them
In all the shells I know about, >> means append to an existing file.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
As somebody mentioned already, tee should work for you.
I believe tee copies all output to stdout to a designated file. So ls -l | tee savefile will display your directory listing in long format to screen, and also save it all to savefile.
>>Which ones, so I know to avoid them
I'll have to ask my unix teacher what shell he was using when he showed us that...I have a feeling it wasn't a popular one though from what you say...might have been a homegrown one just for teaching purposes...
PHP and XML
Let's talk about SAX
Hopefully you misunderstood him. Anyway "tee" is a standard *nix utility which does what you want as described above. It is a simple program to write if you don't have it - you just read characters from stdin, then write them to both stdout and a file whose name you give it on the command line. You could make it a bit more interesting and number the lines you write to the file, maybe also write a start time and end time out to the file to help you find the place you want if you know when the error occurred.