This thread is interesting, but if people are still trying to help with my 
original question, let me just repeat that using tee does solve the problem. 
And since there's been alot of theorizing about C programs and making changes 
to buffer routines in existing programs, let me just say that (for me), none 
of that was really a possibility. All I really wanted to do was to fix the 
following line in a script I use to back-up my PDA using pilot-xfer and I had 
no desire to mess with sources on a great, working program ;-). Here's what I 
had.


pilot-xfer -e $HOME/Palm/backup/exclude-files -s $HOME/Palm/backup/$TODAY  | 
grep "Time elapsed: 0:00:0" > $HOME/Palm/backup/tmp-time


I needed the output file tmp-time to check if the program didn't exit 
immediately - that sometimes happens when there are communications problems 
and I want the script to know how to react to that situation. But using GREP 
meant there was no screen output, since everything went to GREP. And I also 
wanted to be able to see the program scrolling the list of files being backed 
up. The following version outputs to the screen AND to tmp-screen-output, 
which I then GREP to get tmp-time.


pilot-xfer -e $HOME/Palm/backup/exclude-files -s $HOME/Palm/backup/$TODAY I 
tee  tmp-screen-output

cat tmp-screen-output | grep "Time elapsed: 0:00:0" > 
$HOME/Palm/backup/tmp-time


And, as I already wrote, although I can't explain it, the buffer problem 
disappeared. I know it makes no sense, but the first couple of times I ran 
the **tee** version of the script, the screen output was buffered, and since 
I was getting about 100 line of output at a time, the explanation given by 
someone that the buffer is 4096, makes sense. But, when I run the script now, 
it does exactly what I wanted it to.

So problem solve. But, of course, if you want to continue discussing the 
theoretical asspects, go on ...


-- 
Shlomo Solomon
http://come.to/shlomo.solomon
Sent by KMail (KDE 3.0.5a) on LINUX Mandrake 9.0



================================================================To unsubscribe, send 
mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to