LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash stderr redirect question (https://www.linuxquestions.org/questions/linux-software-2/bash-stderr-redirect-question-471201/)

code-breaker 08-06-2006 12:48 AM

bash stderr redirect question
 
I am writing a bash script that will execute a program. The program displays feedback about its progress through stderr. I can capture this output into a variable, but what I would like to do is have the stderr from that program be both displayed normally in the console (updated in real time), and also captured into a variable so that I can grep it later.

The other related question I have is how do programs overwrite a line in the console, like for progress bars?

Thanks.

acid_kewpie 08-06-2006 04:44 AM

i'd suggest either using tee and some juggling (http://www.cpqlinux.com/redirect.html) or just redirect the the file aqlone, and use a tail -f to read anything copied to the file.

as for carriage returns, use \r:
Code:

[chris@kermit ~]$ echo -e 'one\ntwo\rthree'
one
three



All times are GMT -5. The time now is 07:29 PM.