Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-14-2005, 04:22 PM   #1
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Redirecting error messages to stderr and file in Bash

Anyone? I know its something like this, I just can't get the exact syntax.

echo "Error: Error msg" >&2 >>bla.err
That sends the output to the file 'bla' though, I want to send the output to stderr AND the file. BTW I want to append to the file, not overwrite, thanks.
Old 04-14-2005, 07:47 PM   #2
LQ Newbie
Registered: Apr 2005
Distribution: FreeBSD, Fedora Core 3
Posts: 23

Rep: Reputation: 15
echo "Error message" | cat | tee -a bla.err >&2

That should do it.


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
stderr messages bokini Linux - General 1 11-29-2005 08:30 AM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 07:39 PM
redirecting stdout and stderr to a file Avatar33 Programming 4 03-12-2005 08:55 AM
redirecting stderr nodger Programming 2 03-11-2004 11:58 AM
bash scripting - suppress error messages? brian0918 Programming 2 06-19-2003 12:16 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:01 PM.

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