LinuxQuestions.org
Help answer threads with 0 replies.
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 04-05-2011, 08:54 AM   #1
vascot
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
bash output stderr to 2 files and stdout


I want to output the stdout and stderr in a logfile,
moreover i do want to log stderr also to a separate logfile, and print str to the screen

I searched arround and tried:

Code:
$ command 2>&1 > log | tee -a log log.err
But then in log first the stdout appears, and then stderr.
 
Old 04-05-2011, 09:04 AM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
2>&1 redirects stderr to stdout, whereas &> redirects both stderr and stdout to file. That being said:
Code:
2> file.txt
That will redirect stderr to a seperate file. Hope that helps.

Cheers,

Josh
 
  


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
redirecting stdin, stdout and stderr, and finding files name and other stats wroom Programming 4 08-14-2010 07:48 AM
libxml2: removing output on stdout/stderr VincOx Programming 4 07-28-2010 03:40 AM
Can't seem to catch some output from a program - not stdout or stderr. uhh.. help? BrianK Programming 2 01-30-2010 12:53 PM
bash logging stdout plus stderr freeindy Programming 6 01-29-2009 10:16 AM
copying stdout and stderr to seperate files dasy2k1 Linux - General 2 02-09-2007 07:41 AM


All times are GMT -5. The time now is 04:13 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration