Just referring to linux in a nutshell, on bash...
to redirect output, you can just do
cmd n> file
n is the file descriptor...0,1 or 2
n=0 is std input stdin
n=1 is std output stdout
n=2 is std error stderr
Kenn's line below will take 2 (stderr) and duplicate it on 1 (stdout), which is then piped to another-cmd.
LiaNutshell also gives the option
cmd &> file
which redirects stderr and stdout to file,
Anyway, hope this helps a little,
ilug-admin at linux.ie wrote:
> Subject: RE: [ILUG] Logging hack wanted
> Date: Thu, 27 Jan 2000 12:08:05 -0000
> From: "Kenn Humborg" <kenn at bluetree.ie>
> To: "Jeremy Smyth" <JSmyth at Saleslan.com>, <ilug at linux.ie>
>> > Can't pipe the output, because it's sent out on STDERR....
> > So how can I redirect STDERR to STDIN, or sit on STDERR and wait for
> > something to pipe to something else?? Or does anyone have a
> > better solution?
>> $ cmd 2>&1 | another-cmd
>> will pipe both stdout and stderr to another-cmd (in bash, that is).
> There is bound to be a magic incantation to pipe stderr only. Try
> the bash manpage for details.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!