🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.misc
Article #38

Re: Help: how do you redirect compile error to a file

#38
From: frank.
Date: Mon, 18 Mar 1996 10:12
26 lines
1295 bytes
In article <4igdeo$8tf@news.jhu.edu>, yuehong@psi.ece.jhu.edu (yuehong) wrote:

> I try to use the following command when I compile hello.cpp 
> using gcc on linux:
> 
> g++ hello.cpp >bug
> 

Errors go to stderr, the '>' operator only redirects stdout. If you are
using sh/ksh/bash/... then you need 
   
   g++ hello.cpp >bug 2>&1

Basically, this tells the shell to redirect output to file descriptor 2
(stderr) to the same place that the output from file descriptor 1 (stdout)
is going to, which in this case is the file named "bug".

If you are using csh/tcsh/... then you need

   g++ hello.cpp >& bug

This tells the shell to redirect both stdout and stderr to the same file, "bug".

~Frank
 - Through the modem, past the router, over the firewall.. nothing but Net -
 -  PGP ID: 1C0F6685 | NCB#56 | Visit me --> http://www.tdx.org/~fcusack/  -
Technical Details
Message-ID: <fcusack-1803960612430001@mudskipper.cac.psu.edu>
Path: arc1-ca.pugleaf.net!mudskipper.cac.psu.edu!user
References: <4igdeo$8tf@news.jhu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mudskipper.cac.psu.edu!user
From: fcusack@tdx.org (frank.)
Newsgroups: comp.os.linux.misc,comp.lang.c++,gnu.gcc.help
Subject: Re: Help: how do you redirect compile error to a file
Date: Mon, 18 Mar 1996 06:12:43 -0400
Organization: Soylent Green is People!!
Message-ID: <fcusack-1803960612430001@mudskipper.cac.psu.edu>
References: <4igdeo$8tf@news.jhu.edu>
NNTP-Posting-Host: mudskipper.cac.psu.edu