LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-06-2006, 12:48 AM   #1
code-breaker
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
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.
 
Old 08-06-2006, 04:44 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TCSH: redirect stdout and stderr seperately ugenn Linux - General 3 02-07-2016 03:23 PM
Redirecting error messages to stderr and file in Bash lowpro2k3 Programming 1 04-14-2005 06:47 PM
how do i redirect stderr to a file? nodger Programming 5 11-28-2004 11:22 AM
Any one know how to redirect standard error (stderr) to a JetDirect printer? RickMean Linux - General 2 09-03-2004 11:33 AM
question about printing to stderr in C purpleburple Programming 2 10-30-2002 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration